Fix assertion when canceling file dialog

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"
This commit is contained in:
Enrico Forestieri 2023-09-02 18:13:31 +02:00
parent 7eecab5902
commit 1cbcb30353

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