From c556562471e8ed27360adae57e17fc4bfa2cfa6c Mon Sep 17 00:00:00 2001 From: Daniel Koch Date: Tue, 13 Dec 2016 18:45:13 -0500 Subject: [PATCH] libvulkan: add NULL check to DestroySwapchainKHR vkDestroySwapchainKHR is required to silently ignore NULL handles that are provided to it to destroy. This adds an early return if swapchain_handle is NULL. Test: dEQP-VK.wsi.android.swapchain.destroy.null_handle (VK 1.0.2 CTS) Change-Id: Ic230f114a680210cb0e0de931b17e4d70fb27f44 (cherry picked from commit d78c2e8a0807ff45db4cb643cc2ef38eafd22551) --- vulkan/libvulkan/swapchain.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp index adc7d5cf1c..03d37fa895 100644 --- a/vulkan/libvulkan/swapchain.cpp +++ b/vulkan/libvulkan/swapchain.cpp @@ -719,6 +719,8 @@ void DestroySwapchainKHR(VkDevice device, const VkAllocationCallbacks* allocator) { const auto& dispatch = GetData(device).driver; Swapchain* swapchain = SwapchainFromHandle(swapchain_handle); + if (!swapchain) + return; bool active = swapchain->surface.swapchain_handle == swapchain_handle; ANativeWindow* window = active ? swapchain->surface.window.get() : nullptr; -- 2.11.0