From 1e8536191484d7f352fb2049815322971b3c8f39 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 26 Oct 2022 14:30:48 +0200 Subject: [PATCH] Log instead of panicking when we can't retrieve a drawable --- crates/gpui/src/platform/mac/renderer.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/gpui/src/platform/mac/renderer.rs b/crates/gpui/src/platform/mac/renderer.rs index 6a70ff41f0..24c44bb698 100644 --- a/crates/gpui/src/platform/mac/renderer.rs +++ b/crates/gpui/src/platform/mac/renderer.rs @@ -189,7 +189,15 @@ impl Renderer { pub fn render(&mut self, scene: &Scene) { let layer = self.layer.clone(); let drawable_size = layer.drawable_size(); - let drawable = layer.next_drawable().unwrap(); + let drawable = if let Some(drawable) = layer.next_drawable() { + drawable + } else { + log::error!( + "failed to retrieve next drawable, drawable size: {:?}", + drawable_size + ); + return; + }; let command_queue = self.command_queue.clone(); let command_buffer = command_queue.new_command_buffer();