diff options
-rw-r--r-- | src/libudev/libudev-hwdb.c | 2 | ||||
-rw-r--r-- | src/udev/udev-builtin-hwdb.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c index 751b34209e..6779e45b4e 100644 --- a/src/libudev/libudev-hwdb.c +++ b/src/libudev/libudev-hwdb.c @@ -377,7 +377,7 @@ bool udev_hwdb_validate(struct udev_hwdb *hwdb) { _public_ struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned int flags) { int err; - if (!hwdb->f) { + if (!hwdb || !hwdb->f) { errno = EINVAL; return NULL; } diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c index 234448cdf1..0b35d799fe 100644 --- a/src/udev/udev-builtin-hwdb.c +++ b/src/udev/udev-builtin-hwdb.c @@ -33,6 +33,9 @@ int udev_builtin_hwdb_lookup(struct udev_device *dev, const char *modalias, bool struct udev_list_entry *entry; int n = 0; + if (!hwdb) + return -ENOENT; + udev_list_entry_foreach(entry, udev_hwdb_get_properties_list_entry(hwdb, modalias, 0)) { if (udev_builtin_add_property(dev, test, udev_list_entry_get_name(entry), |