Commit e86af019 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr

Simplify updating of unit in editor session

parent 2195eb65
......@@ -140,11 +140,14 @@ IEditableCourse * EditorSession::displayedCourse() const
void EditorSession::updateDisplayedUnit()
{
auto course = displayedCourse();
if (course && !course->unitList().isEmpty()) {
setUnit(course->unitList().constFirst());
} else {
setUnit(nullptr);
Unit * unit{ nullptr };
if (course != nullptr) {
auto units = course->unitList();
if (!units.isEmpty()) {
unit = units.constFirst();
}
}
setUnit(unit);
}
Unit * EditorSession::unit() const
......
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