mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-10 23:11:41 +00:00
settings: avoid silent error hiding
fail if param out of range, addresses #225
This commit is contained in:
parent
84fe779b98
commit
3a4385c7f6
1 changed files with 10 additions and 4 deletions
|
@ -1098,8 +1098,11 @@ fluid_settings_setnum(fluid_settings_t* settings, const char *name, double val)
|
|||
if (node->type == FLUID_NUM_TYPE) {
|
||||
fluid_num_setting_t* setting = &node->num;
|
||||
|
||||
if (val < setting->min) val = setting->min;
|
||||
else if (val > setting->max) val = setting->max;
|
||||
if (val < setting->min || val > setting->max)
|
||||
{
|
||||
FLUID_LOG(FLUID_DBG, "requested set value for %s out of range", name);
|
||||
return retval;
|
||||
}
|
||||
|
||||
setting->value = val;
|
||||
|
||||
|
@ -1247,8 +1250,11 @@ fluid_settings_setint(fluid_settings_t* settings, const char *name, int val)
|
|||
if (node->type == FLUID_INT_TYPE) {
|
||||
fluid_int_setting_t* setting = &node->i;
|
||||
|
||||
if (val < setting->min) val = setting->min;
|
||||
else if (val > setting->max) val = setting->max;
|
||||
if (val < setting->min || val > setting->max)
|
||||
{
|
||||
FLUID_LOG(FLUID_DBG, "requested set value for %s out of range", name);
|
||||
return retval;
|
||||
}
|
||||
|
||||
setting->value = val;
|
||||
|
||||
|
|
Loading…
Reference in a new issue