From e32beea00af2cdb8a2a3d63f4b363d5ab012e407 Mon Sep 17 00:00:00 2001 From: Louis Pontoise Date: Wed, 22 Jun 2022 00:01:57 +0900 Subject: [PATCH] fix: may avoid rare crashes --- src/logic/Window.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/logic/Window.swift b/src/logic/Window.swift index 024e8cd0..3a65e883 100644 --- a/src/logic/Window.swift +++ b/src/logic/Window.swift @@ -95,9 +95,10 @@ class Window { } func refreshThumbnail() { - guard let cgWindowId = cgWindowId, let cgImage = cgWindowId.screenshot() else { return } - thumbnail = NSImage(cgImage: cgImage, size: NSSize(width: cgImage.width, height: cgImage.height)) - thumbnailFullSize = thumbnail!.size + if !isWindowlessApp, let cgWindowId = cgWindowId, cgWindowId != -1, let cgImage = cgWindowId.screenshot() { + thumbnail = NSImage(cgImage: cgImage, size: NSSize(width: cgImage.width, height: cgImage.height)) + thumbnailFullSize = thumbnail!.size + } } func close() {