summaryrefslogtreecommitdiff
path: root/src/modlistsortproxy.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-06-08 22:23:25 +0200
committerTannin <devnull@localhost>2013-06-08 22:23:25 +0200
commit6069decb159ec30b7a69649294ee0e89783bb717 (patch)
treeb1dadc87188d97c9228880c31457751170f3a9bf /src/modlistsortproxy.cpp
parent30dece9093fc27779c9d91d9b573ea6ca2430345 (diff)
- mod list no longer loses selection whenever categories context menu gets hidden
Diffstat (limited to 'src/modlistsortproxy.cpp')
-rw-r--r--src/modlistsortproxy.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp
index ede83659..829140b0 100644
--- a/src/modlistsortproxy.cpp
+++ b/src/modlistsortproxy.cpp
@@ -228,18 +228,20 @@ bool ModListSortProxy::filterMatches(ModInfo::Ptr info, bool enabled) const
bool ModListSortProxy::filterAcceptsRow(int row, const QModelIndex&) const
{
- bool modEnabled = m_Profile != NULL ? m_Profile->modEnabled(row) : false;
+ if (m_Profile == NULL) {
+ return false;
+ }
+
+ if (row >= static_cast<int>(m_Profile->numMods())) {
+ qWarning("invalid row idx %d", row);
+ return false;
+ }
+ bool modEnabled = m_Profile->modEnabled(row);
return filterMatches(ModInfo::getByIndex(row), modEnabled);
}
-/*bool ModListSortProxy::filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const
-{
- return m_EnabledColumns.test(source_column);
-}*/
-
-
bool ModListSortProxy::dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent)
{