Make OnFewPixels require a pixels field.

Fixes bug #29.
This commit is contained in:
PixlOne 2020-04-01 02:31:46 -04:00
parent da689cad35
commit 5a913552b1

View File

@ -404,13 +404,19 @@ ButtonAction* logid::parse_action(Action type, const Setting* action_config, boo
try try
{ {
int pp; int pp;
gesture_config.lookupValue("pixels", pp); if(!gesture_config.lookupValue("pixels", pp))
throw SettingTypeException(gesture_config["pixels"]);
gestures.insert({direction, new Gesture(ba, mode, pp)}); gestures.insert({direction, new Gesture(ba, mode, pp)});
} }
catch(SettingNotFoundException &e) catch(SettingNotFoundException &e)
{ {
log_printf(WARN, "Line %d: OnFewPixels requires a 'pixels' field.", gesture_config.getSourceLine()); log_printf(WARN, "Line %d: OnFewPixels requires a 'pixels' field.", gesture_config.getSourceLine());
} }
catch(SettingTypeException &e)
{
log_printf(WARN, "Line %d: pixels must be an integer", gesture_config["pixels"].getSourceLine());
continue;
}
} }
else gestures.insert({direction, new Gesture(ba, mode)}); else gestures.insert({direction, new Gesture(ba, mode)});
} }