StudioWelcome: fix crash when opening nonexistent recent projects

Task-number: QDS-10085
Change-Id: I038c95f1a5d0975c0f39bb275a6e2f5a2c05c8d6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tim Jenssen
2023-07-25 16:14:09 +02:00
parent 3d7f1a0f7f
commit 0adb3f8cca

View File

@@ -422,8 +422,11 @@ static QString tags(const FilePath &projectFilePath)
QVariant ProjectModel::data(const QModelIndex &index, int role) const
{
if (index.row() >= ProjectExplorer::ProjectExplorerPlugin::recentProjects().count())
if (!index.isValid() ||
index.row() >= ProjectExplorer::ProjectExplorerPlugin::recentProjects().count()) {
return {};
}
const ProjectExplorer::RecentProjectsEntry data =
ProjectExplorer::ProjectExplorerPlugin::recentProjects().at(index.row());