GUI: Do not throw exception when platform is not set (#5099)

This commit is contained in:
Daniel Marjamäki 2023-05-30 19:44:32 +02:00 committed by GitHub
parent 9d6449cc44
commit 8324b75ee0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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());