diff --git a/sidebar/SidebarMode.cpp b/sidebar/SidebarMode.cpp index 3340d6f..8770189 100644 --- a/sidebar/SidebarMode.cpp +++ b/sidebar/SidebarMode.cpp @@ -426,6 +426,10 @@ void SidebarMode::changeModule( const QModelIndex& activeModule ) { d->moduleView->closeModules(); + if (!activeModule.isValid()) { + return; + } + const int subRows = d->searchModel->rowCount(activeModule); if ( subRows < 2) { d->moduleView->loadModule( activeModule ); @@ -449,13 +453,15 @@ int SidebarMode::activeCategory() const void SidebarMode::setActiveCategory(int cat) { + const QModelIndex idx = d->searchModel->index(cat, 0); + int newCategoryRow; if (cat != -1) { setIntroPageVisible(false); + newCategoryRow = d->searchModel->mapToSource(idx).row(); + } else { + newCategoryRow = cat; } - const QModelIndex idx = d->searchModel->index(cat, 0); - const int newCategoryRow = d->searchModel->mapToSource(idx).row(); - if (d->activeCategory == newCategoryRow) { return; }