Don't crash when ID_BUS isn't in the env.
[petitboot] / devices / udev-helper.c
index 1db8a26d6beb9025903e768356742fc9b9fdf0d5..6a9a42bac12e9c626e1c768dd7664edf759ac74c 100644 (file)
@@ -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"))