From 0adb3f8cca57717ffc07699cc23ed08fe3452eee Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Tue, 25 Jul 2023 16:14:09 +0200 Subject: [PATCH] StudioWelcome: fix crash when opening nonexistent recent projects Task-number: QDS-10085 Change-Id: I038c95f1a5d0975c0f39bb275a6e2f5a2c05c8d6 Reviewed-by: Tim Jenssen --- src/plugins/studiowelcome/studiowelcomeplugin.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index d5ad29e44a2..f1e9ac284d2 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -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());