From 58bf3674e98b57b3fa38f1a55948b4ce1d212739 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 2 Oct 2018 11:03:10 +0100 Subject: [PATCH] trivial: Show a critical warning rather than crashing Found when constructing devices manually in the self tests, it's not possible to hit this during normal runtime. --- src/fu-device-list.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/fu-device-list.c b/src/fu-device-list.c index 9edc6dbac..6387ac34c 100644 --- a/src/fu-device-list.c +++ b/src/fu-device-list.c @@ -217,6 +217,12 @@ fu_device_list_find_by_id (FuDeviceList *self, FuDeviceItem *item = NULL; gsize device_id_len; + /* sanity check */ + if (device_id == NULL) { + g_critical ("device ID was NULL"); + return NULL; + } + /* support abbreviated hashes */ device_id_len = strlen (device_id); fu_mutex_read_lock (self->devices_mutex);