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

Fix invalid index on resource creation

On debug builds this can trigger a QAbstractItemModel assert because
a negative index is used.

BUG: 436510
parent 4ec0047b
......@@ -54,7 +54,7 @@ public:
virtual QVector<std::shared_ptr<ILanguage>> languages() const = 0;
Q_SIGNALS:
void courseAboutToBeAdded(std::shared_ptr<ICourse>, int);
void courseAboutToBeAdded(std::shared_ptr<ICourse>, int index);
void courseAdded();
void courseAboutToBeRemoved(int);
void courseRemoved();
......
......@@ -122,7 +122,7 @@ bool ResourceRepository::loadCourse(const QString &resourceFile)
return false;
}
emit courseAboutToBeAdded(resource, m_courses.count() - 1);
emit courseAboutToBeAdded(resource, m_courses.count());
m_courses.append(resource);
emit courseAdded();
m_loadedCourses.append(resourceFile);
......
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