mirror of
https://github.com/labwc/labwc.git
synced 2026-02-16 22:05:27 -05:00
Prevent missing direction arguments to segfault labwc
Reported-by: @Flrian
This commit is contained in:
parent
0a7e380c14
commit
986ab70780
2 changed files with 20 additions and 2 deletions
10
src/view.c
10
src/view.c
|
|
@ -460,6 +460,10 @@ view_move_to_edge(struct view *view, const char *direction)
|
|||
wlr_log(WLR_ERROR, "no output");
|
||||
return;
|
||||
}
|
||||
if (!direction) {
|
||||
wlr_log(WLR_ERROR, "invalid edge");
|
||||
return;
|
||||
}
|
||||
struct wlr_box usable = output_usable_area_in_layout_coords(output);
|
||||
if (usable.height == output->wlr_output->height
|
||||
&& output->wlr_output->scale != 1) {
|
||||
|
|
@ -485,6 +489,9 @@ view_move_to_edge(struct view *view, const char *direction)
|
|||
x = view->x;
|
||||
y = usable.y + usable.height - view->h - view->margin.bottom
|
||||
- rc.gap;
|
||||
} else {
|
||||
wlr_log(WLR_ERROR, "invalid edge");
|
||||
return;
|
||||
}
|
||||
view_move(view, x, y);
|
||||
}
|
||||
|
|
@ -521,6 +528,9 @@ view_edge_invert(enum view_edge edge)
|
|||
static enum view_edge
|
||||
view_edge_parse(const char *direction)
|
||||
{
|
||||
if (!direction) {
|
||||
return VIEW_EDGE_INVALID;
|
||||
}
|
||||
if (!strcasecmp(direction, "left")) {
|
||||
return VIEW_EDGE_LEFT;
|
||||
} else if (!strcasecmp(direction, "up")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue