mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
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:
parent
bb50c7a5a4
commit
8fb4e4dabb
1 changed files with 2 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue