Skip to content

Commit

Permalink
Added a check to see if the instance and physical device are valid be…
Browse files Browse the repository at this point in the history
…fore running
  • Loading branch information
ThomasJowett committed Jun 9, 2023
1 parent 4aca2ab commit 6157b56
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 6157b56

Please sign in to comment.