diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2021-03-20 14:51:44 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2021-03-20 14:51:44 -0400 |
| commit | 234ee923fe51a92acc723084bcc97ba6565664cb (patch) | |
| tree | 1466078485ff4b613059a1a7155ecc6799bc907b /src | |
| parent | fcd2e1473fa426bf10a9824e16192d75014875f2 (diff) | |
model() can return null for invalid indexes
happens when looking at the mod info for a mod filtered out of the mod list
Diffstat (limited to 'src')
| -rw-r--r-- | src/modlistview.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/modlistview.cpp b/src/modlistview.cpp index 47fc880d..2dcd9f92 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -347,6 +347,9 @@ QModelIndexList ModListView::indexViewToModel(const QModelIndexList& index) cons QModelIndex ModListView::nextIndex(const QModelIndex& index) const
{
auto* model = index.model();
+ if (!model) {
+ return {};
+ }
if (model->rowCount(index) > 0) {
return model->index(0, index.column(), index);
@@ -372,6 +375,10 @@ QModelIndex ModListView::prevIndex(const QModelIndex& index) const }
auto* model = index.model();
+ if (!model) {
+ return {};
+ }
+
auto prev = model->index((index.row() - 1) % model->rowCount(index.parent()), index.column(), index.parent());
if (model->rowCount(prev) > 0) {
|
