fix a crash with unknown screen resolution in .megaglest
This commit is contained in:
titiger 2017-08-29 01:27:53 +02:00
parent 056078909a
commit 9d12682fb5
1 changed files with 10 additions and 0 deletions

View File

@ -598,6 +598,16 @@ void MenuStateOptionsGraphics::mouseClick(int x, int y, MouseButton mouseButton)
selectedMode = &(*it);
}
}
if(selectedMode == NULL) { // if we cannot find the selectedResolution we try it with current one
for(vector<ModeInfo>::const_iterator it= modeInfos.begin(); it!=modeInfos.end(); ++it) {
if((*it).getString() == currentResolution) {
//config.setInt("ScreenWidth",(*it).width);
//config.setInt("ScreenHeight",(*it).height);
//config.setInt("ColorBits",(*it).depth);
selectedMode = &(*it);
}
}
}
if(selectedMode == NULL) {
throw megaglest_runtime_error("selectedMode == NULL");
}