Merge pull request #132 from zed-industries/fix-key-window

Ensure key window is a GPUIWindow before returning its id
This commit is contained in:
Antonio Scandurra 2021-09-03 17:59:02 +02:00 committed by GitHub
commit c3f1d43861
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -245,11 +245,11 @@ impl Window {
unsafe {
let app = NSApplication::sharedApplication(nil);
let key_window: id = msg_send![app, keyWindow];
if key_window.is_null() {
None
} else {
if msg_send![key_window, isKindOfClass: WINDOW_CLASS] {
let id = get_window_state(&*key_window).borrow().id;
Some(id)
} else {
None
}
}
}