cube: Check return value of vkGetPhysicalDeviceSurfaceSupportKHR
diff --git a/cube/cube.c b/cube/cube.c
index f1123ac..d2b9bac 100644
--- a/cube/cube.c
+++ b/cube/cube.c
@@ -4145,7 +4145,7 @@
     volkLoadInstance(demo->inst);
 }
 
-static void demo_select_physical_device(struct demo* demo) {
+static void demo_select_physical_device(struct demo *demo) {
     VkResult err;
     /* Make initial call to query gpu_count, then second call for gpu info */
     uint32_t gpu_count = 0;
@@ -4192,8 +4192,8 @@
 
                 // Continue next gpu if this gpu does not support the surface.
                 VkBool32 supported = VK_FALSE;
-                vkGetPhysicalDeviceSurfaceSupportKHR(physical_devices[i], 0, demo->surface, &supported);
-                if (!supported) continue;
+                VkResult result = vkGetPhysicalDeviceSurfaceSupportKHR(physical_devices[i], 0, demo->surface, &supported);
+                if (result != VK_SUCCESS || !supported) continue;
 
                 int priority = 0;
                 switch (physicalDeviceProperties.deviceType) {