Skip to content

Commit 1ffa436

Browse files
authored
Fix xwayland fullscreen crash (#135)
Introduces a trivial fix for a crash in xwayland that could be triggered when a view with NULL size hints tried to go fullscreen
1 parent 586e3b8 commit 1ffa436

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/viv_xwayland_shell.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -369,17 +369,20 @@ static void implementation_grow_and_center_fullscreen(struct viv_view *view) {
369369
}
370370

371371
int width = output->wlr_output->width;
372-
if ((hints->max_width > 0) && ((int) hints->max_width < width)) {
373-
width = hints->max_width;
374-
} else if ((hints->min_width > 0) && ((int) hints->min_width > width)) {
375-
width = hints->min_width;
376-
}
377-
378372
int height = output->wlr_output->height;
379-
if ((hints->max_height > 0) && ((int) hints->max_height < height)) {
380-
height = hints->max_height;
381-
} else if ((hints->min_height > 0) && ((int) hints->min_height > height)) {
382-
height = hints->min_height;
373+
374+
if (hints) {
375+
if ((hints->max_width > 0) && ((int) hints->max_width < width)) {
376+
width = hints->max_width;
377+
} else if ((hints->min_width > 0) && ((int) hints->min_width > width)) {
378+
width = hints->min_width;
379+
}
380+
381+
if ((hints->max_height > 0) && ((int) hints->max_height < height)) {
382+
height = hints->max_height;
383+
} else if ((hints->min_height > 0) && ((int) hints->min_height > height)) {
384+
height = hints->min_height;
385+
}
383386
}
384387

385388
int x = (output->wlr_output->width - width) / 2;

0 commit comments

Comments
 (0)