]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix crash calling openDirectories() in various cases
authorNate Graham <nate@kde.org>
Tue, 30 Mar 2021 19:30:27 +0000 (13:30 -0600)
committerNate Graham <nate@kde.org>
Wed, 31 Mar 2021 15:19:33 +0000 (09:19 -0600)
This can cause a crash when called with a single url and split view, or
when the last URL is not shown, because the iterator gets mutated in
the loop, so we need to make sure it hasn't gone out of bounds. This
check was erroneously removed in 175538020824355115cd98637ce83ecc53badd44
and needs to be brought back.

src/dolphintabwidget.cpp

index 17fa0ff4e336b4c44364ea2abce42b9d87562b3a..0a024235ba248eb33f8ad088afc5496069d55606 100644 (file)
@@ -210,7 +210,7 @@ void DolphinTabWidget::openDirectories(const QList<QUrl>& dirs, bool splitView)
             // Required for updateViewState() call in openFiles() to work as expected
             // If there is a selection, updateViewState() calls are effectively a no-op
             tabPage->activeViewContainer()->view()->clearSelection();
-        } else if (splitView) {
+        } else if (splitView && (it != dirs.constEnd())) {
             const QUrl& secondaryUrl = *(it++);
             if (somethingWasAlreadyOpen) {
                 openNewTab(primaryUrl, secondaryUrl);