summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2018-03-13 21:14:27 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-03-14 23:59:03 -0700
commit0c2f11cee62cb88b37b1986effbd58e407a972bf (patch)
tree25603a9e9525e2571e920e1daff57d397708d785
parent749f5c8d65056763398aad5e9eb786fe52b8fede (diff)
downloadmpv-0c2f11cee62cb88b37b1986effbd58e407a972bf.tar.bz2
mpv-0c2f11cee62cb88b37b1986effbd58e407a972bf.tar.xz
cocoa-cb: fix crash on startup with not initialised title bar
the first mouse events, that try to hide the title bar, could happen before the title bar was actually initialised. that caused our hiding code to access a nil value. check for an available title bar before trying to hide it.
-rw-r--r--video/out/cocoa-cb/window.swift3
1 files changed, 2 insertions, 1 deletions
diff --git a/video/out/cocoa-cb/window.swift b/video/out/cocoa-cb/window.swift
index e413dbfa6d..040cd47751 100644
--- a/video/out/cocoa-cb/window.swift
+++ b/video/out/cocoa-cb/window.swift
@@ -158,7 +158,7 @@ class Window: NSWindow, NSWindowDelegate {
}
func showTitleBar() {
- if !border && !isInFullscreen { return }
+ if titleBarEffect == nil || (!border && !isInFullscreen) { return }
let loc = cocoaCB.view.convert(mouseLocationOutsideOfEventStream, from: nil)
titleButtons.forEach { $0.isHidden = false }
@@ -178,6 +178,7 @@ class Window: NSWindow, NSWindowDelegate {
}
func hideTitleBar() {
+ if titleBarEffect == nil { return }
if isInFullscreen && !isAnimating {
titleBarEffect!.alphaValue = 0
return