summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Bessent <lost.dragonist@gmail.com>2021-04-29 01:59:05 -0700
committerGitHub <noreply@github.com>2021-04-29 01:59:05 -0700
commit3c6190d7134aaa1d5239e047fe7c3149d3dbe49a (patch)
tree764630583e31bfc4a0a9964f9fba24254ce505a3 /src
parent1197b562f6c044ace8c78739780cb5829df50c10 (diff)
parent234ee923fe51a92acc723084bcc97ba6565664cb (diff)
Merge pull request #1470 from isanae/filtered-nav-crash
Crash for next/previous in mod info dialog
Diffstat (limited to 'src')
-rw-r--r--src/modlistview.cpp7
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) {