[gnome-shell] [runDialog] Fix adding entries to empty history



commit 51478f16ec3fc3ea71b85e4ec38de8877a9d2c77
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Jun 9 15:30:40 2010 +0200

    [runDialog] Fix adding entries to empty history
    
    Before adding a new entry to the history, we check that it does not
    match the previous entry to cut down the number of duplicate entries.
    Part of that condition is a check for a history length greater zero
    to avoid an illegal negative index, with the side effect that nothing
    is ever added while the history is empty.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=621123

 js/ui/runDialog.js |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index 02c84d9..28615b5 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -333,7 +333,8 @@ RunDialog.prototype = {
     _run : function(input, inTerminal) {
         let command = input;
 
-        if (this._history.length > 0 && this._history[this._history.length - 1] != input) {
+        if (this._history.length == 0 ||
+            this._history[this._history.length - 1] != input) {
             this._history.push(input);
             this._saveHistory();
         }



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