diff options
author | David Eklov <david.eklov@gmail.com> | 2016-07-17 22:47:20 -0500 |
---|---|---|
committer | David Eklov <david.eklov@gmail.com> | 2016-07-17 22:50:15 -0500 |
commit | d202ca2fd7c1be75ea9a4f122a3cc18fabde16e8 (patch) | |
tree | 9283ac10b610b726adcf4d1248123da958c01a58 | |
parent | Fix clang warning (diff) | |
download | sway-d202ca2fd7c1be75ea9a4f122a3cc18fabde16e8.tar.gz sway-d202ca2fd7c1be75ea9a4f122a3cc18fabde16e8.tar.zst sway-d202ca2fd7c1be75ea9a4f122a3cc18fabde16e8.zip |
Do not crash when handling the command 'move position'
Sway expected 'move position' to be 'move position mouse'. If mouse is not
present in the command, Sway crashes.
-rw-r--r-- | sway/commands.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c index 73f245c1..1dec9889 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -1115,7 +1115,14 @@ static struct cmd_results *cmd_move(int argc, char **argv) { | |||
1115 | focused = swayc_active_workspace(); | 1115 | focused = swayc_active_workspace(); |
1116 | } | 1116 | } |
1117 | set_focused_container(focused); | 1117 | set_focused_container(focused); |
1118 | } else if (strcasecmp(argv[0], "position") == 0 && strcasecmp(argv[1], "mouse") == 0) { | 1118 | } else if (strcasecmp(argv[0], "position") == 0) { |
1119 | if ((error = checkarg(argc, "move workspace", EXPECTED_EQUAL_TO, 2))) { | ||
1120 | return error; | ||
1121 | } | ||
1122 | if (strcasecmp(argv[1], "mouse")) { | ||
1123 | return cmd_results_new(CMD_INVALID, "move", expected_syntax); | ||
1124 | } | ||
1125 | |||
1119 | if (view->is_floating) { | 1126 | if (view->is_floating) { |
1120 | swayc_t *output = swayc_parent_by_type(view, C_OUTPUT); | 1127 | swayc_t *output = swayc_parent_by_type(view, C_OUTPUT); |
1121 | struct wlc_geometry g; | 1128 | struct wlc_geometry g; |