From 0429f5d6a36fc35b551bcc2acd4a40c2db6dab82 Mon Sep 17 00:00:00 2001
From: Semphris <[EMAIL REDACTED]>
Date: Mon, 15 Apr 2024 11:57:24 -0400
Subject: [PATCH] Replace if() with SDL_assert()
If the if statement was not fulfilled, the pointers passed would be silently left unfilled.
---
src/video/wayland/SDL_waylandwindow.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index 4a11ab56a35d9..5af5add456bfe 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -2471,11 +2471,12 @@ void Wayland_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
void Wayland_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h)
{
SDL_WindowData *data;
- if (window->driverdata) {
- data = window->driverdata;
- *w = data->current.drawable_width;
- *h = data->current.drawable_height;
- }
+
+ SDL_assert(window->driverdata)
+
+ data = window->driverdata;
+ *w = data->current.drawable_width;
+ *h = data->current.drawable_height;
}
void Wayland_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)