From c56d85bd20c6f9050af563ad9c9fc963eeafb92c Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 7 Aug 2023 23:04:43 -0700
Subject: [PATCH] Fixed testautomation --filter
video_getWindowGammaRampNegative
---
src/sdl2_compat.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 842abf0..efa47f5 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -2305,7 +2305,13 @@ SDL_CalculateGammaRamp(float gamma, Uint16 *ramp)
DECLSPEC int SDLCALL
SDL_GetWindowGammaRamp(SDL_Window *window, Uint16 *red, Uint16 *blue, Uint16 *green)
{
- Uint16 *buf = red ? red : (green ? green : blue);
+ Uint16 *buf;
+
+ if (!window) {
+ return SDL_SetError("Invalid window");
+ }
+
+ buf = red ? red : (green ? green : blue);
if (buf) {
SDL_CalculateGammaRamp(1.0f, buf);
if (red && (red != buf)) {