1
1
mirror of https://github.com/swaywm/sway synced 2024-11-18 23:14:03 +01:00

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.
This commit is contained in:
David Eklov 2016-07-17 22:47:20 -05:00
parent 2530f952c9
commit d202ca2fd7

@ -1115,7 +1115,14 @@ static struct cmd_results *cmd_move(int argc, char **argv) {
focused = swayc_active_workspace();
}
set_focused_container(focused);
} else if (strcasecmp(argv[0], "position") == 0 && strcasecmp(argv[1], "mouse") == 0) {
} else if (strcasecmp(argv[0], "position") == 0) {
if ((error = checkarg(argc, "move workspace", EXPECTED_EQUAL_TO, 2))) {
return error;
}
if (strcasecmp(argv[1], "mouse")) {
return cmd_results_new(CMD_INVALID, "move", expected_syntax);
}
if (view->is_floating) {
swayc_t *output = swayc_parent_by_type(view, C_OUTPUT);
struct wlc_geometry g;