summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2018-08-09 16:06:00 +0200
committerJan Ekström <jeebjp@gmail.com>2018-09-29 22:22:20 +0300
commit7b91bf7f202730206ca092c64776ef6f158ea2df (patch)
tree11de07874aa70f90e3eddc0aaf576685c2892e6f
parent4243d067616c867d748f91f73e8154697e8e5a90 (diff)
downloadmpv-7b91bf7f202730206ca092c64776ef6f158ea2df.tar.bz2
mpv-7b91bf7f202730206ca092c64776ef6f158ea2df.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 (cherry picked from commit 6bf0edc59cc377705a44fcb30890592aaaff79c0)
-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)