aboutsummaryrefslogtreecommitdiffhomepage
path: root/hyprctl
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-11-11 14:04:35 +0000
committervaxerski <[email protected]>2022-11-11 14:04:35 +0000
commit61995e3b4ef526274519528278fd62089240e3fc (patch)
tree3341ddbc3ce3a1945a590ef0a1b0ef742bf1c2bb /hyprctl
parent13befbd26636076caeb148f343144fda76fcffb5 (diff)
downloadHyprland-61995e3b4ef526274519528278fd62089240e3fc.tar.gz
Hyprland-61995e3b4ef526274519528278fd62089240e3fc.zip
guard empty str in isNumber
Diffstat (limited to 'hyprctl')
-rw-r--r--hyprctl/main.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/hyprctl/main.cpp b/hyprctl/main.cpp
index 49327b75..516a3080 100644
--- a/hyprctl/main.cpp
+++ b/hyprctl/main.cpp
@@ -251,6 +251,8 @@ std::deque<std::string> splitArgs(int argc, char** argv) {
}
bool isNumber(const std::string& str, bool allowfloat) {
+ if (str.empty())
+ return false;
return std::ranges::all_of(str.begin(), str.end(), [&](char c) { return isdigit(c) != 0 || c == '-' || (allowfloat && c == '.'); });
}