From a8f1d74bc40090e37fac0db362574b755871e6dc Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 20 May 2023 15:35:34 +0100 Subject: [PATCH] Log an error if `SDL_CreateColorCursor` fails --- Source/hwcursor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/hwcursor.cpp b/Source/hwcursor.cpp index 8b0f4af92..705653696 100644 --- a/Source/hwcursor.cpp +++ b/Source/hwcursor.cpp @@ -102,8 +102,11 @@ bool SetHardwareCursorFromSurface(SDL_Surface *surface, HotpointPosition hotpoin const Point hotpoint = GetHotpointPosition(*scaledSurface, hotpointPosition); newCursor = SDLCursorUniquePtr { SDL_CreateColorCursor(scaledSurface.get(), hotpoint.x, hotpoint.y) }; } - if (newCursor == nullptr) + if (newCursor == nullptr) { + LogError("SDL_CreateColorCursor: {}", SDL_GetError()); + SDL_ClearError(); return false; + } SDL_SetCursor(newCursor.get()); CurrentCursor = std::move(newCursor); return true;