From cecc53a0e011fa20a1c67e6a2bd6ab098fb51c08 Mon Sep 17 00:00:00 2001 From: Robinhuett <5955614+Robinhuett@users.noreply.github.com> Date: Sun, 5 Jan 2020 01:41:39 +0100 Subject: [PATCH] fix: app crashes when no windows are open --- alt-tab-macos/logic/TrackedWindows.swift | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/alt-tab-macos/logic/TrackedWindows.swift b/alt-tab-macos/logic/TrackedWindows.swift index 212cf912..ac00634c 100644 --- a/alt-tab-macos/logic/TrackedWindows.swift +++ b/alt-tab-macos/logic/TrackedWindows.swift @@ -25,11 +25,13 @@ class TrackedWindows { } private class func isSingleSpace() { - let firstSpaceIndex = list[0].spaceIndex - for window in list { - if window.spaceIndex != nil && window.spaceIndex != firstSpaceIndex { - Spaces.singleSpace = false - return + if list.count > 0 { + let firstSpaceIndex = list[0].spaceIndex + for window in list { + if window.spaceIndex != nil && window.spaceIndex != firstSpaceIndex { + Spaces.singleSpace = false + return + } } } Spaces.singleSpace = true