action/view: Ensure view arguments are never NULL

This commit is contained in:
John Lindgren 2022-11-22 02:09:42 -05:00 committed by Consolatis
parent 004b817647
commit 0e6d99e0ca
2 changed files with 37 additions and 15 deletions

View file

@ -247,18 +247,22 @@ actions_run(struct view *activator, struct server *server,
wl_display_terminate(server->wl_display);
break;
case ACTION_TYPE_MOVE_TO_EDGE:
if (arg) {
view_move_to_edge(view, action_str_from_arg(arg));
} else {
if (!arg) {
wlr_log(WLR_ERROR, "Missing argument for MoveToEdge");
break;
}
if (view) {
view_move_to_edge(view, action_str_from_arg(arg));
}
break;
case ACTION_TYPE_SNAP_TO_EDGE:
if (arg) {
if (!arg) {
wlr_log(WLR_ERROR, "Missing argument for SnapToEdge");
break;
}
if (view) {
view_snap_to_edge(view, action_str_from_arg(arg),
/*store_natural_geometry*/ true);
} else {
wlr_log(WLR_ERROR, "Missing argument for SnapToEdge");
}
break;
case ACTION_TYPE_NEXT_WINDOW: