diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index e488af94..dd74a3c0 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -1822,8 +1822,13 @@ void VulkanExampleBase::initxcbConnection() xcb_screen_iterator_t iter; int scr; + // xcb_connect always returns a non-NULL pointer to a xcb_connection_t, + // even on failure. Callers need to use xcb_connection_has_error() to + // check for failure. When finished, use xcb_disconnect() to close the + // connection and free the structure. connection = xcb_connect(NULL, &scr); - if (connection == NULL) { + assert( connection ); + if( xcb_connection_has_error(connection) ) { printf("Could not find a compatible Vulkan ICD!\n"); fflush(stdout); exit(1); @@ -2227,4 +2232,4 @@ void VulkanExampleBase::setupSwapChain() swapChain.create(&width, &height, settings.vsync); } -void VulkanExampleBase::OnUpdateUIOverlay(vks::UIOverlay *overlay) {} \ No newline at end of file +void VulkanExampleBase::OnUpdateUIOverlay(vks::UIOverlay *overlay) {}