Fix crash calling openDirectories() in various cases

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 1755380208
and needs to be brought back.
This commit is contained in:
Nate Graham 2021-03-30 13:30:27 -06:00
parent 38e83eacf8
commit b9139c5e1c

View 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);