]> git.lyx.org Git - features.git/commitdiff
Fix assertion when canceling file dialog
authorEnrico Forestieri <forenr@lyx.org>
Sat, 2 Sep 2023 16:13:31 +0000 (18:13 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Sat, 2 Sep 2023 16:15:09 +0000 (18:15 +0200)
Without this patch, when a file has to be loaded (for example,
after "Document->Settings->Local Class" or "Insert->Graphics")
and the file dialog is canceled, both Qt5 and Qt6 assert:
ASSERT failure in QList::at: "index out of range"

src/frontends/qt/FileDialog.cpp

index 704c34c9e8cb8674107c8fa962d08eb8c6fa3b3d..be9953967506eef9cb77145a09d027fa40060a46 100644 (file)
@@ -137,7 +137,8 @@ FileDialog::Result FileDialog::open(QString const & path,
        FileDialog::Result result;
        FileDialog::Results results = openMulti(path, filters, suggested, false);
        result.first = results.first;
-       result.second = results.second.at(0);
+       if (result.first != FileDialog::Later)
+               result.second = results.second.at(0);
        return result;
 }