[gnome-shell] history: Fix bogus return value



commit b50d7143d11e0fd8a4d29acbea3d4750956aa4e5
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Jun 13 04:56:34 2017 +0200

    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 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/js/misc/history.js b/js/misc/history.js
index b56d830..44d21b7 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) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]