mirror of
https://github.com/ModOrganizer2/modorganizer.git
synced 2026-07-27 13:58:24 -07:00
Merge pull request #1470 from isanae/filtered-nav-crash
Crash for next/previous in mod info dialog
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user