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