mirror of
https://github.com/mpv-player/mpv
synced 2024-11-03 03:19:24 +01:00
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.
This commit is contained in:
parent
749f5c8d65
commit
0c2f11cee6
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user