Skip to content

Commit

Permalink
Fix bug with empty windows array.
Browse files Browse the repository at this point in the history
Always check before trying to activate a "null" window.
  • Loading branch information
micheleg committed Mar 25, 2017
1 parent 168e7eb commit f415fa8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions appIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,17 @@ const MyAppIcon = new Lang.Class({
}

let focusedApp = tracker.focus_app;
if (!Main.overview._shown){
if (!Main.overview._shown) {
let reversed = direction === Meta.MotionDirection.UP;
if (this.app == focusedApp)
cycleThroughWindows(this.app, this._dtdSettings, reversed);
else {
// Activate the first window
let windows = getInterestingWindows(this.app, this._dtdSettings);
let w = windows[0];
Main.activateWindow(w);
if (windows.length > 0) {
let w = windows[0];
Main.activateWindow(w);
}
}
}
else
Expand Down Expand Up @@ -644,6 +646,9 @@ function cycleThroughWindows(app, settings, reversed) {

let app_windows = getInterestingWindows(app, settings);

if (app_windows.length <1)
return

if (recentlyClickedAppLoopId > 0)
Mainloop.source_remove(recentlyClickedAppLoopId);
recentlyClickedAppLoopId = Mainloop.timeout_add(MEMORY_TIME, resetRecentlyClickedApp);
Expand Down

0 comments on commit f415fa8

Please sign in to comment.