From: Jeremy Kerr Date: Thu, 5 Apr 2007 03:59:29 +0000 (+1000) Subject: Don't crash when ID_BUS isn't in the env. X-Git-Tag: v0.0.1~17 X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=commitdiff_plain;h=6ce15c4265d3813ee311756ec03c6e4da74c1dbd;hp=c26b2a1d05865bc92e795797e5d0535edd2aca77 Don't crash when ID_BUS isn't in the env. Signed-off-by: Jeremy Kerr --- diff --git a/devices/udev-helper.c b/devices/udev-helper.c index 1db8a26..6a9a42b 100644 --- a/devices/udev-helper.c +++ b/devices/udev-helper.c @@ -372,6 +372,8 @@ enum generic_icon_type guess_device_type(void) const char *bus = getenv("ID_BUS"); if (type && streq(type, "cd")) return ICON_TYPE_OPTICAL; + if (!bus) + return ICON_TYPE_UNKNOWN; if (streq(bus, "usb")) return ICON_TYPE_USB; if (streq(bus, "ata") || streq(bus, "scsi"))