From 8324b75ee041e00b84ef65b056feeb2ed16b2441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 30 May 2023 19:44:32 +0200 Subject: [PATCH] GUI: Do not throw exception when platform is not set (#5099) --- gui/projectfiledialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp index 47e6c3965..b3e8624a3 100644 --- a/gui/projectfiledialog.cpp +++ b/gui/projectfiledialog.cpp @@ -434,7 +434,7 @@ void ProjectFileDialog::saveToProjectFile(ProjectFile *projectFile) const projectFile->setPlatform(mUI->mComboBoxPlatform->currentText()); else { const int i = mUI->mComboBoxPlatform->currentIndex(); - if (i < numberOfBuiltinPlatforms) + if (i>=0 && i < numberOfBuiltinPlatforms) projectFile->setPlatform(cppcheck::Platform::toString(builtinPlatforms[i])); else projectFile->setPlatform(QString());