From 0042f2c040d5144906a151b1c7185d302b887e3e Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 27 May 2021 09:35:53 -0400
Subject: [PATCH] Deal with allocation of physical palette failing.
---
src/SDL12_compat.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 35a922c..efece0e 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -3577,6 +3577,9 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags12)
}
if (!VideoPhysicalPalette20) {
VideoPhysicalPalette20 = SDL20_AllocPalette(256);
+ if (!VideoPhysicalPalette20) {
+ return EndVidModeCreate();
+ }
}
SDL20_SetPaletteColors(VideoPhysicalPalette20, VideoSurface12->format->palette->colors, 0, 256);
}