swapchain: assert that size is not empty at creation time

Failing later (at buffer allocation time) makes it more difficult
to track down where the issue comes from.
This commit is contained in:
Simon Ser 2025-05-30 23:10:39 +02:00 committed by Kenny Levinsen
parent bb50c7a5a4
commit 8fb4e4dabb

View file

@ -18,6 +18,8 @@ static void swapchain_handle_allocator_destroy(struct wl_listener *listener,
struct wlr_swapchain *wlr_swapchain_create(
struct wlr_allocator *alloc, int width, int height,
const struct wlr_drm_format *format) {
assert(width > 0 && height > 0);
struct wlr_swapchain *swapchain = calloc(1, sizeof(*swapchain));
if (swapchain == NULL) {
return NULL;