summaryrefslogtreecommitdiff
path: root/common/util.c
diff options
context:
space:
mode:
authorWilliam McKinnon <[email protected]>2022-04-26 21:44:51 -0400
committerGitHub <[email protected]>2022-04-26 21:44:51 -0400
commit4660771f6a25b93062df0698634059f893ae1999 (patch)
treeb7135d20119a42d8381fb65004f476750d6212fd /common/util.c
parentccda4dae0f9b77b9760d6fdf178e0f0e2571cde0 (diff)
parent5543acff06981639086bc9a0fc9b608796a23e84 (diff)
Merge pull request #1 from swaywm/v1.7
V1.7
Diffstat (limited to 'common/util.c')
-rw-r--r--common/util.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/util.c b/common/util.c
index 199f3ee1..5d4c0673 100644
--- a/common/util.c
+++ b/common/util.c
@@ -80,6 +80,12 @@ enum movement_unit parse_movement_unit(const char *unit) {
int parse_movement_amount(int argc, char **argv,
struct movement_amount *amount) {
+ if (!sway_assert(argc > 0, "Expected args in parse_movement_amount")) {
+ amount->amount = 0;
+ amount->unit = MOVEMENT_UNIT_INVALID;
+ return 0;
+ }
+
char *err;
amount->amount = (int)strtol(argv[0], &err, 10);
if (*err) {