diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 13c00b0ac3..33d76d2737 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -2311,6 +2311,11 @@ error: SDL_Surface *SDL_ConvertSurfaceRect(SDL_Surface *surface, const SDL_Rect *rect, SDL_PixelFormat format) { + CHECK_PARAM(!SDL_SurfaceValid(surface)) { + SDL_InvalidParamError("surface"); + return NULL; + } + return SDL_ConvertSurfaceRectAndColorspace(surface, NULL, format, NULL, SDL_GetDefaultColorspaceForFormat(format), surface->props); }