diff --git a/src/main.rs b/src/main.rs index e909f0c..6fe24e2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -99,7 +99,11 @@ impl VulkanApp { }; let vk_result = unsafe { - ffi_vk::vkCreateInstance(std::ptr::addr_of!(create_info), std::ptr::null(), std::ptr::addr_of_mut!(self.vk_instance)) + ffi_vk::vkCreateInstance( + std::ptr::addr_of!(create_info), + std::ptr::null(), + std::ptr::addr_of_mut!(self.vk_instance), + ) }; if vk_result != ffi_vk::VkResult_VK_SUCCESS { @@ -112,6 +116,10 @@ impl VulkanApp { panic!("ERROR: Cannot execute main loop if window is null!"); } + if self.vk_instance.is_null() { + panic!("ERROR: Cannot execute main loop if vk_instance is null!"); + } + loop { unsafe { if ffi_glfw::glfwWindowShouldClose(self.window) != 0 {