From fabd1e3db3dc4ecbe47188b2841671d5a9656d80 Mon Sep 17 00:00:00 2001 From: Brooke Chalmers Date: Thu, 9 Nov 2023 23:14:56 -0500 Subject: [PATCH] Fix panic on startup on macos --- src/platform/winit/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/platform/winit/mod.rs b/src/platform/winit/mod.rs index ad0bdfc..4ee4f0d 100644 --- a/src/platform/winit/mod.rs +++ b/src/platform/winit/mod.rs @@ -97,7 +97,10 @@ impl SyncPlatform for WinitPlatform { } if let Some(size) = input.window_resized() { - pixels.resize_surface(size.width, size.height).unwrap(); + // Winit bug, sometimes we get window_resized with -1 + if size.width != u32::MAX && size.height != u32::MAX { + pixels.resize_surface(size.width, size.height).unwrap() + } } }