From 5e50412dc0204b19f3b00833fc722874e52e0a25 Mon Sep 17 00:00:00 2001 From: tachyglossues <81535731+tachyglossues@users.noreply.github.com> Date: Tue, 4 Jun 2024 18:44:53 +0200 Subject: [PATCH] fix #6249 fix https://github.com/hyprwm/Hyprland/issues/6249 --- src/config/ConfigManager.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 2a3938cd..3f58149c 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1706,8 +1706,13 @@ std::optional CConfigManager::handleMonitor(const std::string& comm newrule.resolution.x = stoi(ARGS[1].substr(0, ARGS[1].find_first_of('x'))); newrule.resolution.y = stoi(ARGS[1].substr(ARGS[1].find_first_of('x') + 1, ARGS[1].find_first_of('@'))); - if (ARGS[1].contains("@")) - newrule.refreshRate = stof(ARGS[1].substr(ARGS[1].find_first_of('@') + 1)); + if (ARGS[1].contains("@")) { + try { + newrule.refreshRate = stof(ARGS[1].substr(ARGS[1].find_first_of('@') + 1)); + } catch (...) { + return "invalid argument for framerate"; + } + } } } @@ -1821,10 +1826,11 @@ std::optional CConfigManager::handleBezier(const std::string& comma const auto ARGS = CVarList(args); std::string bezierName = ARGS[0]; - if (ARGS[1] == "" || ARGS[2] == "" || ARGS[3] == "" || ARGS[4] == "") - return "too few arguments"; - if (ARGS[5]!= "") - return "too many arguments"; + + if (ARGS.size() < 5) + return "too few arguments"; + if (ARGS[5]!= "") + return "too many arguments"; float p1x = 0, p1y = 0, p2x = 0, p2y = 0; try {