alternate-tab: don't assume that at least two windows exist

Initial selection would go out of the array bounds if only one window
existed.
This commit is contained in:
Giovanni Campagna
2012-08-27 14:25:01 +02:00
parent d91c949068
commit 45da997dd3

View File

@@ -149,10 +149,11 @@ const AltTabPopup = new Lang.Class({
this._appSwitcher.connect('item-entered', Lang.bind(this, this._windowEntered));
// make the initial selection
this._currentWindow = 0;
if (backward)
this._select(windows.length - 1);
this._select(this._previousWindow());
else
this._select(1);
this._select(this._nextWindow());
this.actor.opacity = 0;
this.actor.show();