Commit 0d19dee9 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr
Browse files

Ensure learner exists before accessing.

parent a2c9ed8f
......@@ -235,6 +235,10 @@ QList< Learner* > Storage::loadProfiles(QList<LearningGoal*> goals)
break;
}
}
if (!learner) {
qCCritical(LIBLEARNER_LOG) << "Could not retrieve learner from database.";
return QList<Learner*>();
}
foreach (LearningGoal *cmpGoal, goals) {
if (cmpGoal->category() == goalRelationQuery.value(0).toInt()
&& cmpGoal->identifier() == goalRelationQuery.value(1).toString())
......@@ -247,8 +251,7 @@ QList< Learner* > Storage::loadProfiles(QList<LearningGoal*> goals)
if (learner->goals().contains(goal)) {
continue;
}
if (goal && learner) {
if (goal) {
learner->addGoal(goal);
}
}
......
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