From 0c2f11cee62cb88b37b1986effbd58e407a972bf Mon Sep 17 00:00:00 2001 From: Akemi Date: Tue, 13 Mar 2018 21:14:27 +0100 Subject: 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. --- video/out/cocoa-cb/window.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3