]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincolumnview.cpp
prevent an invalid active column index if columns have been deleted
[dolphin.git] / src / dolphincolumnview.cpp
index ee217b2bd3177faa012fcb4ac3a9e8e8a72ef895..9fb3e35a81a9bc9987a5f450a77f8faca79ce255 100644 (file)
@@ -536,6 +536,12 @@ void DolphinColumnView::showColumn(const KUrl& url)
                     (*it)->deleteLater();
                 }
                 m_columns.erase(start, end);
+
+                const int maxIndex = m_columns.count() - 1;
+                Q_ASSERT(maxIndex >= 0);
+                if (m_index > maxIndex) {
+                    m_index = maxIndex;
+                }
                 break;
             }
         }