Browse Source

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

Sam Lantinga 9 months ago
parent
commit
c057849035
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/render/SDL_render.c

+ 5 - 0
src/render/SDL_render.c

@@ -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);