Fix potential null accesses

master
Ashkan Kiani 6 years ago committed by Drew DeVault
parent e7d6b8ec3e
commit 913445e112

@ -311,6 +311,7 @@ static bool container_move_in_direction(struct sway_container *container,
while (current) { while (current) {
list_t *siblings = container_get_siblings(current); list_t *siblings = container_get_siblings(current);
if (siblings) {
enum sway_container_layout layout = container_parent_layout(current); enum sway_container_layout layout = container_parent_layout(current);
int index = list_find(siblings, current); int index = list_find(siblings, current);
int desired = index + offs; int desired = index + offs;
@ -344,12 +345,14 @@ static bool container_move_in_direction(struct sway_container *container,
return true; return true;
} }
} }
}
current = current->parent; current = current->parent;
} }
// Maybe rejigger the workspace // Maybe rejigger the workspace
struct sway_workspace *ws = container->workspace; struct sway_workspace *ws = container->workspace;
if (ws) {
if (!is_parallel(ws->layout, move_dir)) { if (!is_parallel(ws->layout, move_dir)) {
workspace_rejigger(ws, container, move_dir); workspace_rejigger(ws, container, move_dir);
return true; return true;
@ -370,6 +373,7 @@ static bool container_move_in_direction(struct sway_container *container,
return true; return true;
} }
sway_log(SWAY_DEBUG, "Hit edge of output, nowhere else to go"); sway_log(SWAY_DEBUG, "Hit edge of output, nowhere else to go");
}
return false; return false;
} }

@ -1194,6 +1194,7 @@ void seat_consider_warp_to_focus(struct sway_seat *seat) {
} }
if (config->mouse_warping == WARP_OUTPUT) { if (config->mouse_warping == WARP_OUTPUT) {
struct sway_output *output = node_get_output(focus); struct sway_output *output = node_get_output(focus);
if (output) {
struct wlr_box box; struct wlr_box box;
output_get_box(output, &box); output_get_box(output, &box);
if (wlr_box_contains_point(&box, if (wlr_box_contains_point(&box,
@ -1201,6 +1202,7 @@ void seat_consider_warp_to_focus(struct sway_seat *seat) {
return; return;
} }
} }
}
if (focus->type == N_CONTAINER) { if (focus->type == N_CONTAINER) {
cursor_warp_to_container(seat->cursor, focus->sway_container); cursor_warp_to_container(seat->cursor, focus->sway_container);

Loading…
Cancel
Save