Return the correct error from SDL_CreateSoftwareRenderer() when the surface is NULL

This commit is contained in:
Sam Lantinga 2024-07-05 08:05:20 -07:00
parent f9a06c20ed
commit c057849035
1 changed files with 5 additions and 0 deletions

View File

@ -1156,6 +1156,11 @@ SDL_Renderer *SDL_CreateSoftwareRenderer(SDL_Surface *surface)
{
#if SDL_VIDEO_RENDER_SW
SDL_Renderer *renderer;
if (!surface) {
SDL_InvalidParamError("surface");
}
SDL_PropertiesID props = SDL_CreateProperties();
SDL_SetProperty(props, SDL_PROP_RENDERER_CREATE_SURFACE_POINTER, surface);
renderer = SDL_CreateRendererWithProperties(props);