fix: add null pointer checking
authorDanny Zhu <danny@netflt.com>
Tue, 25 Oct 2022 14:30:29 +0000 (22:30 +0800)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Tue, 25 Oct 2022 15:08:22 +0000 (09:08 -0600)
loader/loader.c

index 84031dfb44e499163c56355c666143e3212dc577..00a0273da7c8183a5901d2621fd00984aafaae67 100644 (file)
@@ -4307,9 +4307,12 @@ VKAPI_ATTR void VKAPI_CALL loader_layer_destroy_device(VkDevice device, const Vk
     const struct loader_instance *inst = icd_term->this_instance;
 
     destroyFunction(device, pAllocator);
-    dev->chain_device = NULL;
-    dev->icd_device = NULL;
-    loader_remove_logical_device(inst, icd_term, dev, pAllocator);
+    if (NULL != dev)
+    {
+        dev->chain_device = NULL;
+        dev->icd_device = NULL;
+        loader_remove_logical_device(inst, icd_term, dev, pAllocator);
+    }
 }
 
 // Given the list of layers to activate in the loader_instance