From 18577a70dd18bfd16f1de7ac5473eb838b042a43 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 12 Dec 2017 16:37:23 -0800 Subject: [PATCH] Fixed bug 3992 - SDL_GetColorKey doesn't set error message Luke A. Guest SDL_GetColorKey does not set an error message on failure. The current source just returns -1. The documentation https://wiki.libsdl.org/SDL_GetColorKey?highlight=%28%5CbCategoryAPI%5Cb%29%7C%28SDLFunctionTemplate%29 says to call SDL_GetError but that is useless in this case. --- src/video/SDL_surface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 2e114284ae8e7..f944914154ada 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -296,11 +296,11 @@ int SDL_GetColorKey(SDL_Surface * surface, Uint32 * key) { if (!surface) { - return -1; + return SDL_InvalidParamError("surface"); } if (!(surface->map->info.flags & SDL_COPY_COLORKEY)) { - return -1; + return SDL_SetError("Surface doesn't have a colorkey"); } if (key) {