From 874e3c7a28de4cf416ecf0a8b84f0bf567b675c2 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() + } } }