Index: src/presentation/artifacteditormodel.cpp =================================================================== --- src/presentation/artifacteditormodel.cpp +++ src/presentation/artifacteditormodel.cpp @@ -68,7 +68,7 @@ int rowCount(const QModelIndex &parent) const override { - if (parent.isValid()) + if (parent.isValid() || !m_task) return 0; return m_task->attachments().size(); Index: tests/units/presentation/artifacteditormodeltest.cpp =================================================================== --- tests/units/presentation/artifacteditormodeltest.cpp +++ tests/units/presentation/artifacteditormodeltest.cpp @@ -82,6 +82,8 @@ QVERIFY(model.delegateText().isNull()); QVERIFY(!model.hasSaveFunction()); QVERIFY(!model.hasDelegateFunction()); + auto am = model.attachmentModel(); + QCOMPARE(am->rowCount(), 0); } void shouldHaveTaskProperties()