From f5b7a66162367f7ce61038163619a720a067a6f5 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 20 Jan 2026 17:47:05 +0000
Subject: [PATCH] Don't set surface properties if we couldn't load a surface
---
src/IMG_bmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/IMG_bmp.c b/src/IMG_bmp.c
index 36c5d688..4180d96d 100644
--- a/src/IMG_bmp.c
+++ b/src/IMG_bmp.c
@@ -549,7 +549,7 @@ static SDL_Surface *GetIconSurface(SDL_IOStream *src, Sint64 offset, int type, i
SDL_SetError("Unsupported ICO bitmap format");
}
- if (type == ICON_TYPE_CUR) {
+ if (type == ICON_TYPE_CUR && surface) {
SDL_PropertiesID props = SDL_GetSurfaceProperties(surface);
SDL_SetNumberProperty(props, SDL_PROP_SURFACE_HOTSPOT_X_NUMBER, hot_x);
SDL_SetNumberProperty(props, SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER, hot_y);