summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2018-08-09 16:06:00 +0200
committersfan5 <sfan5@live.de>2018-08-11 12:59:44 +0200
commit6bf0edc59cc377705a44fcb30890592aaaff79c0 (patch)
tree2257a1503f8621093fabd169d2dbd9de867e0573
parentf2311ff51461ec9539efb00458b8a54ded56511b (diff)
downloadmpv-6bf0edc59cc377705a44fcb30890592aaaff79c0.tar.bz2
mpv-6bf0edc59cc377705a44fcb30890592aaaff79c0.tar.xz
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
-rw-r--r--video/out/cocoa-cb/events_view.swift2
1 files changed, 1 insertions, 1 deletions
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)