Qt: Fix crash when first CLI command is empty (fixes #693)

This commit is contained in:
Vicki Pfau 2017-04-22 00:41:58 -07:00
parent 2d930cbc61
commit 8c095ec885
1 changed files with 3 additions and 0 deletions

View File

@ -88,6 +88,9 @@ const char* DebuggerConsoleController::historyLast(struct CLIDebuggerBackend* be
DebuggerConsoleController* self = consoleBe->self;
GameController::Interrupter interrupter(self->m_gameController, true);
QMutexLocker lock(&self->m_mutex);
if (self->m_history.isEmpty()) {
return nullptr;
}
self->m_last = self->m_history.last().toUtf8();
return self->m_last.constData();
}