From 6157b56b70328668f855458c8ab29f867061b9b0 Mon Sep 17 00:00:00 2001 From: Thomas Jowett Date: Fri, 9 Jun 2023 11:47:21 +0100 Subject: [PATCH] Added a check to see if the instance and physical device are valid before running --- src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.rs b/src/main.rs index ddec207..0c88ea1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -110,6 +110,14 @@ mod halvar { } pub fn run(self) { + if Arc::strong_count(&self.instance) == 0 { + println!("Cannot run application without a vulkan instance"); + return; + } + if Arc::strong_count(&self.physical_device) == 0 { + println!("Cannot run application without a physical rendering device"); + return; + } self.event_loop .run(move |event, _, control_flow| match event { Event::WindowEvent {