settings: avoid silent error hiding

fail if param out of range, addresses #225
This commit is contained in:
derselbst 2017-10-06 10:28:28 +02:00
parent 84fe779b98
commit 3a4385c7f6

View file

@ -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;