mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-22 08:08:53 -05:00
Fix crash when preset amount is too high (#4359)
This commit is contained in:
parent
5d8841777a
commit
fca8081a20
@ -42,7 +42,10 @@ void applyPreset(std::vector<PresetEntry> entries) {
|
||||
void DrawPresetSelector(PresetType presetTypeId) {
|
||||
const std::string presetTypeCvar = CVAR_GENERAL("SelectedPresets.") + std::to_string(presetTypeId);
|
||||
const PresetTypeDefinition presetTypeDef = presetTypes.at(presetTypeId);
|
||||
const uint16_t selectedPresetId = CVarGetInteger(presetTypeCvar.c_str(), 0);
|
||||
uint16_t selectedPresetId = CVarGetInteger(presetTypeCvar.c_str(), 0);
|
||||
if(selectedPresetId >= presetTypeDef.presets.size()){
|
||||
selectedPresetId = 0;
|
||||
}
|
||||
const PresetDefinition selectedPresetDef = presetTypeDef.presets.at(selectedPresetId);
|
||||
std::string comboboxTooltip = "";
|
||||
for ( auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter ) {
|
||||
|
Loading…
Reference in New Issue
Block a user