From 73e0e8cf5b52535ffe3d16cc29bf3e377fbd53f6 Mon Sep 17 00:00:00 2001
From: Petar Popovic <[EMAIL REDACTED]>
Date: Sun, 3 Nov 2024 15:07:46 +0100
Subject: [PATCH] SDL_GetDisplayForPoint(), SDL_GetDisplayForRect(): Check
argument for NULL.
---
src/video/SDL_video.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index f7ddb304fa833..dabcc64382184 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -1594,11 +1594,21 @@ void SDL_GlobalToRelativeForWindow(SDL_Window *window, int abs_x, int abs_y, int
SDL_DisplayID SDL_GetDisplayForPoint(const SDL_Point *point)
{
+ if (!point) {
+ SDL_InvalidParamError("point");
+ return 0;
+ }
+
return GetDisplayForRect(point->x, point->y, 1, 1);
}
SDL_DisplayID SDL_GetDisplayForRect(const SDL_Rect *rect)
{
+ if (!rect) {
+ SDL_InvalidParamError("rect");
+ return 0;
+ }
+
return GetDisplayForRect(rect->x, rect->y, rect->w, rect->h);
}