From e676eae640a07d586859fb549db193e85577cd79 Mon Sep 17 00:00:00 2001 From: Alexander Lais Date: Mon, 28 Jul 2025 23:05:05 +0200 Subject: [PATCH] macos: fix quick terminal fullscreen Fullscreen on quick terminal was failing with a crash, when it tried to save the state of a non-existent toolbar and its accessory view controllers. --- macos/Sources/Helpers/Fullscreen.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/macos/Sources/Helpers/Fullscreen.swift b/macos/Sources/Helpers/Fullscreen.swift index f3940a9aa..6c70e8cf7 100644 --- a/macos/Sources/Helpers/Fullscreen.swift +++ b/macos/Sources/Helpers/Fullscreen.swift @@ -407,8 +407,14 @@ class NonNativeFullscreen: FullscreenBase, FullscreenStyle { self.styleMask = window.styleMask self.toolbar = window.toolbar self.toolbarStyle = window.toolbarStyle - self.titlebarAccessoryViewControllers = window.titlebarAccessoryViewControllers self.dock = window.screen?.hasDock ?? false + + self.titlebarAccessoryViewControllers = if (window.hasTitleBar) { + // Accessing titlebarAccessoryViewControllers without a titlebar triggers a crash. + window.titlebarAccessoryViewControllers + } else { + [] + } if let cgWindowId = window.cgWindowId { // We hide the menu only if this window is not on any fullscreen