From 5a913552b1211566ec35abcf2d4cc067ac62f233 Mon Sep 17 00:00:00 2001 From: PixlOne <8843371+PixlOne@users.noreply.github.com> Date: Wed, 1 Apr 2020 02:31:46 -0400 Subject: [PATCH] Make OnFewPixels require a pixels field. Fixes bug #29. --- src/logid/Configuration.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/logid/Configuration.cpp b/src/logid/Configuration.cpp index 99f41c4..e7f8a18 100644 --- a/src/logid/Configuration.cpp +++ b/src/logid/Configuration.cpp @@ -404,13 +404,19 @@ ButtonAction* logid::parse_action(Action type, const Setting* action_config, boo try { 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)}); } catch(SettingNotFoundException &e) { 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)}); }