From 6532ff73a8c3eb85c22de27342c0dc38fe7e70d6 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 29 Dec 2023 07:53:20 -0800 Subject: [PATCH] macos: verify inspector is not nil before sending it to draw --- macos/Sources/Ghostty/InspectorView.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/macos/Sources/Ghostty/InspectorView.swift b/macos/Sources/Ghostty/InspectorView.swift index 1b1d7270f..074431274 100644 --- a/macos/Sources/Ghostty/InspectorView.swift +++ b/macos/Sources/Ghostty/InspectorView.swift @@ -426,6 +426,10 @@ extension Ghostty { return } + // If the inspector is nil, then our surface is freed and it is unsafe + // to use. + guard let inspector = self.inspector else { return } + // We always update our size because sometimes draw is called // between resize events and if our size is wrong with the underlying // drawable we will crash.