commands/move: Fix crash when pos_y is omitted

Fixes #6737

(cherry picked from commit 1bf1d84b75)
This commit is contained in:
David96 2022-01-08 19:33:19 +01:00 committed by Simon Ser
parent 828a9a3cfb
commit 3ab1c7f153

View file

@ -874,6 +874,10 @@ static struct cmd_results *cmd_move_to_position(int argc, char **argv) {
return cmd_results_new(CMD_INVALID, "Invalid x position specified"); return cmd_results_new(CMD_INVALID, "Invalid x position specified");
} }
if (argc < 1) {
return cmd_results_new(CMD_FAILURE, expected_position_syntax);
}
struct movement_amount ly = { .amount = 0, .unit = MOVEMENT_UNIT_INVALID }; struct movement_amount ly = { .amount = 0, .unit = MOVEMENT_UNIT_INVALID };
// Y direction // Y direction
num_consumed_args = parse_movement_amount(argc, argv, &ly); num_consumed_args = parse_movement_amount(argc, argv, &ly);