[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
This commit is contained in:
Florian Müllner 2010-06-09 15:30:40 +02:00
parent 528930d0a9
commit 51478f16ec

View File

@ -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();
}