diff --git a/RedPandaIDE/widgets/qconsole.cpp b/RedPandaIDE/widgets/qconsole.cpp index e2570e6d..4466a9b3 100644 --- a/RedPandaIDE/widgets/qconsole.cpp +++ b/RedPandaIDE/widgets/qconsole.cpp @@ -795,6 +795,8 @@ void QConsole::loadCommandFromHistory() mCommand = mCommandHistory[mHistoryIndex]; else mCommand = ""; + if (mHistoryIndex>mCommandHistory.length()) + mHistoryIndex=mCommandHistory.length(); QString lastLine = mContents.getLastLine(); int len=mCurrentEditableLine.length(); lastLine.remove(lastLine.length()-len,INT_MAX);