- fix: ide failed to start, if there are errors in the compiler set settings

This commit is contained in:
royqh1979 2021-11-18 10:42:41 +08:00
parent a2e514e98a
commit b8f75cb337
2 changed files with 18 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 0.9.1 For Dev-C++ 7 Beta Version 0.9.1 For Dev-C++ 7 Beta
- enhancement: code completion suggestion for "__func__" variable - enhancement: code completion suggestion for "__func__" variable
- fix: ide failed to start, if there are errors in the compiler set settings
Version 0.9.0 For Dev-C++ 7 Beta Version 0.9.0 For Dev-C++ 7 Beta
- fix: control keys in the numpad doesn't work in the editor - fix: control keys in the numpad doesn't work in the editor

View File

@ -2393,11 +2393,19 @@ void Settings::CompilerSets::loadSets()
mDefaultIndex =mSettings->mSettings.value(SETTING_COMPILTER_SETS_DEFAULT_INDEX,-1).toInt(); mDefaultIndex =mSettings->mSettings.value(SETTING_COMPILTER_SETS_DEFAULT_INDEX,-1).toInt();
int listSize = mSettings->mSettings.value(SETTING_COMPILTER_SETS_COUNT,0).toInt(); int listSize = mSettings->mSettings.value(SETTING_COMPILTER_SETS_COUNT,0).toInt();
mSettings->mSettings.endGroup(); mSettings->mSettings.endGroup();
bool loadError = false;
for (int i=0;i<listSize;i++) { for (int i=0;i<listSize;i++) {
PCompilerSet pSet=loadSet(i); PCompilerSet pSet=loadSet(i);
if (!pSet) {
loadError = true;
break;
}
mList.push_back(pSet); mList.push_back(pSet);
} }
if (loadError) {
mList.clear();
mDefaultIndex = -1;
}
PCompilerSet pCurrentSet = defaultSet(); PCompilerSet pCurrentSet = defaultSet();
if (pCurrentSet) { if (pCurrentSet) {
QString msg; QString msg;
@ -2419,6 +2427,9 @@ void Settings::CompilerSets::loadSets()
mDefaultIndex = mList.size()-1; mDefaultIndex = mList.size()-1;
pCurrentSet = defaultSet(); pCurrentSet = defaultSet();
if (!pCurrentSet) { if (!pCurrentSet) {
mList.clear();
mDefaultIndex = -1;
saveSets();
return; return;
} }
saveSet(mDefaultIndex); saveSet(mDefaultIndex);
@ -2442,6 +2453,9 @@ void Settings::CompilerSets::loadSets()
findSets(); findSets();
pCurrentSet = defaultSet(); pCurrentSet = defaultSet();
if (!pCurrentSet) { if (!pCurrentSet) {
mList.clear();
mDefaultIndex = -1;
saveSets();
return; return;
} }
saveSets(); saveSets();
@ -2641,6 +2655,8 @@ Settings::PCompilerSet Settings::CompilerSets::loadSet(int index)
mSettings->mSettings.endGroup(); mSettings->mSettings.endGroup();
if (pSet->binDirs().isEmpty())
return PCompilerSet();
pSet->setDirectories(pSet->binDirs()[0]); pSet->setDirectories(pSet->binDirs()[0]);
pSet->setDefines(); pSet->setDefines();
return pSet; return pSet;