From 6069decb159ec30b7a69649294ee0e89783bb717 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sat, 8 Jun 2013 22:23:25 +0200 Subject: - mod list no longer loses selection whenever categories context menu gets hidden --- src/modlistsortproxy.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/modlistsortproxy.cpp') 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(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) { -- cgit v1.3.1