-
-
Notifications
You must be signed in to change notification settings - Fork 251
Description
Describe the bug
The application crashes during startup when using tao 0.32.5 on macOS. The crash occurs because the code in window.rs (line 288) unconditionally calls unwrap() on an Option value returned by standardWindowButton, which becomes None when certain window buttons are disabled in the configuration.
Steps To Reproduce
- Create a macOS application using tao 0.32.5
- Configure a window with some standard buttons disabled, such as:
{
"fullscreen": false,
"resizable": false,
"minimizable": false,
"maximizable": false,
"closable": false
}- Attempt to run the application
- The application crashes during initialization with an "unwrap on None" panic
Expected behavior
The application should properly handle cases where window buttons are disabled in the configuration, checking if the standardWindowButton returns a value before attempting to unwrap it.
Platform and Versions (please complete the following information):
OS: macOS 15.3.1 (24D70)
Rustc: rustc 1.85.0 (4d91de4e4 2025-02-17)
Additional context
The issue occurs specifically in the macOS platform implementation. When window buttons are disabled through configuration, the standardWindowButton method returns None, but the code doesn't check for this possibility before calling unwrap().
According to Apple's documentation (https://developer.apple.com/documentation/appkit/nswindow/standardwindowbutton(_:)), the standardWindowButton(_:) method can return nil:
This is precisely what's happening when buttons are disabled in the window configuration - the method correctly returns nil (None in Rust terms), but the tao implementation tries to unwrap this value unconditionally.
A proper fix would involve using if let Some(button) = window.standardWindowButton(...) or similar pattern matching to safely handle cases where buttons are disabled or not available, rather than directly unwrapping the returned value.