From f415fa8616fcca989660470208b997ce92f21781 Mon Sep 17 00:00:00 2001 From: Michele Date: Fri, 24 Mar 2017 23:20:14 +0000 Subject: [PATCH] Fix bug with empty windows array. Always check before trying to activate a "null" window. --- appIcons.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/appIcons.js b/appIcons.js index 0067e9865..b1c71941c 100644 --- a/appIcons.js +++ b/appIcons.js @@ -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 @@ -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);