mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-10 01:14:01 +02:00
only call QList::constFirst when history list isn't empty
This commit is contained in:
parent
9c610f52ec
commit
300b926464
1 changed files with 1 additions and 1 deletions
|
@ -122,7 +122,7 @@ void JSConsole::setScriptEngine(ScriptEngine* scriptEngine) {
|
|||
}
|
||||
|
||||
void JSConsole::executeCommand(const QString& command) {
|
||||
if (_commandHistory.constFirst() != command) {
|
||||
if (_commandHistory.isEmpty() || _commandHistory.constFirst() != command) {
|
||||
_commandHistory.prepend(command);
|
||||
if (_commandHistory.length() > MAX_HISTORY_SIZE) {
|
||||
_commandHistory.removeLast();
|
||||
|
|
Loading…
Reference in a new issue