]> diplodocus.org Git - xorg-xinput/commitdiff
test-xi2: add an extra NULL-check
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 12 Sep 2018 23:39:22 +0000 (09:39 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 12 Sep 2018 23:39:22 +0000 (09:39 +1000)
Shuts up coverity because it doesn't know that by the time we get here, we're
guaranteed that the device exists. Otherwise the list() call a few lines above
would've failed and we wouldn't get here.

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

index 402acacf36b7eb11a8d6db96c4dbab59fd24de56..10a46c3a4fdb3139ce3c4e3942401d2e2c60b2e0 100644 (file)
@@ -358,6 +358,10 @@ test_xi2(Display   *display,
     if (argc >= 1) {
         XIDeviceInfo *info;
         info = xi2_find_device_info(display, argv[0]);
     if (argc >= 1) {
         XIDeviceInfo *info;
         info = xi2_find_device_info(display, argv[0]);
+        /* info is alway valid, the list() call exits if the device
+           cannot be found, but let's shut up coverity */
+        if (!info)
+            return EXIT_FAILURE;
         deviceid = info->deviceid;
     }
 
         deviceid = info->deviceid;
     }