From 6bf0edc59cc377705a44fcb30890592aaaff79c0 Mon Sep 17 00:00:00 2001 From: Akemi Date: Thu, 9 Aug 2018 16:06:00 +0200 Subject: cocoa-cb: fix crash when no screen is available instead of force unwrapping and chaining the optional vars in our containsMouseLocation function, safely unwrap and guard the resulting var. Fixes #6062 --- video/out/cocoa-cb/events_view.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/out/cocoa-cb/events_view.swift b/video/out/cocoa-cb/events_view.swift index 7cc295f362..5a84d27b2b 100644 --- a/video/out/cocoa-cb/events_view.swift +++ b/video/out/cocoa-cb/events_view.swift @@ -233,7 +233,7 @@ class EventsView: NSView { topMargin = cocoaCB.window.titleBarHeight + 1 + menuBarHeight } - var vF = window!.screen!.frame + guard var vF = window?.screen?.frame else { return false } vF.size.height -= topMargin let vFW = window!.convertFromScreen(vF) -- cgit v1.2.3