Commit 008193ba authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr
Browse files

Handle empty phrase lists gracefully.

parent 52911901
......@@ -238,7 +238,11 @@ Phrase * EditorSession::nextPhrase() const
Unit *unit = m_phrase->unit();
int uIndex = unit->course()->unitList().indexOf(unit);
if (uIndex < unit->course()->unitList().length() - 1) {
return unit->course()->unitList().at(uIndex + 1)->phraseList().first();
Unit *nextUnit = unit->course()->unitList().at(uIndex + 1);
if (nextUnit->phraseList().isEmpty()) {
return nullptr;
}
return nextUnit->phraseList().first();
}
}
return nullptr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment