history: Fix bogus return value

We only use lastItem() to reset the history index to the end, so
nobody noticed the utter nonsense in the return value until gjs
started to warn about it. As we don't actually use the value
anywhere, we could just remove it, but the function name implies
that an item is returned, so fix it to behave as advertised.

https://bugzilla.gnome.org/show_bug.cgi?id=781471
This commit is contained in:
Florian Müllner 2017-06-13 04:56:34 +02:00
parent 28d098394a
commit b50d7143d1

View File

@ -69,7 +69,7 @@ const HistoryManager = new Lang.Class({
this._indexChanged();
}
return this._historyIndex[this._history.length];
return this._historyIndex ? this._history[this._historyIndex -1] : null;
},
addItem: function(input) {