fix: app crashes when invoked when there is 0 window (closes #95)

This commit is contained in:
louis.pontoise authored and lwouis committed 2019-12-30 09:49:56 +09:00
1 parent 9c218f0cf7
commit 921590aec5
2 files changed
+3 -1

No files matched your search

-1
View File
@@ -22,7 +22,6 @@ class TrackedWindows {
Spaces.currentSpaceIndex = spaces.first { $0.0 == Spaces.currentSpaceId }!.1
filterAndAddToList(mapWindowsWithRankAndSpace(spaces))
sortList()
TrackedWindows.focusedWindowIndex = TrackedWindows.moveFocusedWindowIndex(step)
}
private static func mapWindowsWithRankAndSpace(_ spaces: [(CGSSpaceID, SpaceIndex)]) -> [CGWindowID: (CGSSpaceID, SpaceIndex, WindowRank)] {
+3
View File
@@ -77,8 +77,11 @@ class Application: NSApplication, NSApplicationDelegate, NSWindowDelegate {
isFirstSummon = false
TrackedWindows.refreshList(step)
if TrackedWindows.list.count == 0 {
appIsBeingUsed = false
isFirstSummon = true
return
}
TrackedWindows.focusedWindowIndex = TrackedWindows.moveFocusedWindowIndex(step)
let currentScreen = Screen.preferred() // fix screen between steps since it could change (e.g. mouse moved to another screen)
if uiWorkShouldBeDone { self.thumbnailsPanel!.computeThumbnails(currentScreen); debugPrint("computeThumbnails") }
if uiWorkShouldBeDone { self.thumbnailsPanel!.highlightCellAt(step); debugPrint("highlightCellAt") }