Skip to content

Commit

Permalink
fix: app crashes when invoked when there is 0 window (closes #95)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis.pontoise authored and lwouis committed Dec 30, 2019
1 parent 9c218f0 commit 921590a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion alt-tab-macos/logic/TrackedWindows.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)] {
Expand Down
3 changes: 3 additions & 0 deletions alt-tab-macos/ui/Application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
Expand Down

0 comments on commit 921590a

Please sign in to comment.