From c2d94e9c83cc4e6bb605fbcfb7bbf2a62db8d0f9 Mon Sep 17 00:00:00 2001 From: Danny Zhu Date: Tue, 25 Oct 2022 22:30:29 +0800 Subject: fix: add null pointer checking --- loader/loader.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/loader/loader.c b/loader/loader.c index 84031dfb4..00a0273da 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -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 -- cgit v1.2.3