If we never initialized the libwacom database, don't check the refcount
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 26 Jun 2019 04:15:09 +0000 (14:15 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 26 Jun 2019 04:15:09 +0000 (14:15 +1000)
If the libwacom context failed to initialize for some reason, the database is
NULL and the refcount remains at zero. Calling unref should just work then.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/libinput.c

index c0cd2fa..6d00a00 100644 (file)
@@ -4257,6 +4257,9 @@ libinput_libwacom_ref(struct libinput *li)
 void
 libinput_libwacom_unref(struct libinput *li)
 {
+       if (!li->libwacom.db)
+               return;
+
        assert(li->libwacom.refcount >= 1);
 
        if (--li->libwacom.refcount == 0) {