summaryrefslogtreecommitdiff
path: root/src/config/ConfigManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-08-03 21:06:51 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-08-03 21:06:51 +0200
commit5a96142cf844939c560b554be914aa4fd40822a0 (patch)
treeeb645379726d5734e4d7c460f5a3c02317631e55 /src/config/ConfigManager.cpp
parent9540106959182e6810e257ac8f708d754ac49069 (diff)
guard monitor settings
Diffstat (limited to 'src/config/ConfigManager.cpp')
-rw-r--r--src/config/ConfigManager.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index a383227f..8e004790 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -449,17 +449,27 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string
if (curitem.contains("@"))
newrule.refreshRate = stof(curitem.substr(curitem.find_first_of('@') + 1));
- }
+ }
nextItem();
newrule.offset.x = stoi(curitem.substr(0, curitem.find_first_of('x')));
newrule.offset.y = stoi(curitem.substr(curitem.find_first_of('x') + 1));
+ if (newrule.offset.x < 0 || newrule.offset.y < 0) {
+ parseError = "invalid offset. Offset cannot be negative.";
+ newrule.offset = Vector2D();
+ }
+
nextItem();
newrule.scale = stof(curitem);
+ if (newrule.scale < 0.25f) {
+ parseError = "not a valid scale.";
+ newrule.scale = 1;
+ }
+
nextItem();
if (curitem != "") {