From 8fb4e4dabb1526b939003345dab2a9744018b056 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 30 May 2025 23:10:39 +0200 Subject: [PATCH] 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. --- render/swapchain.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/render/swapchain.c b/render/swapchain.c index e87a99ead..24d6f1a87 100644 --- a/render/swapchain.c +++ b/render/swapchain.c @@ -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;