From b50d7143d11e0fd8a4d29acbea3d4750956aa4e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 13 Jun 2017 04:56:34 +0200 Subject: [PATCH] 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 --- js/misc/history.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/misc/history.js b/js/misc/history.js index b56d83064..44d21b7d6 100644 --- a/js/misc/history.js +++ b/js/misc/history.js @@ -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) {