From 51478f16ec3fc3ea71b85e4ec38de8877a9d2c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 9 Jun 2010 15:30:40 +0200 Subject: [PATCH] [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 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js index 02c84d964..28615b5ed 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(); }