libvulkan: add a nullptr check for ANativeWindow*

When VK_GOOGLE_display_timing extension is in use, if the swapchain is
not in active status, during vkDestroySwapchainKHR, a nullptr checker
for the ANativeWindow* is missing and that will cause a crashing when
calling window api with window being nullptr. This change just adds a
nullptr check for that ANativeWindow*.

Bug: 134185757
Test: manual
Change-Id: Ica4543666c4aadc0a4d9a6caddaefd4ab08f8627
Merged-In: Ic8a4baf7e219cc8e1fb3838d4e4b710b242efa9c
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index 3db8a39..bb5c151 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -1306,7 +1306,7 @@
     bool active = swapchain->surface.swapchain_handle == swapchain_handle;
     ANativeWindow* window = active ? swapchain->surface.window.get() : nullptr;
 
-    if (swapchain->frame_timestamps_enabled) {
+    if (window && swapchain->frame_timestamps_enabled) {
         native_window_enable_frame_timestamps(window, false);
     }
     for (uint32_t i = 0; i < swapchain->num_images; i++)