Browse Source

SDL_BlitSurfaceScaled(): Do not blit if surfaces have no pixel data

(cherry picked from commit 8017d38adc2f1ce30c507e6b00ed7fb429645462)
Petar Popovic 4 months ago
parent
commit
6d8309f72e
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/video/SDL_surface.c

+ 2 - 2
src/video/SDL_surface.c

@@ -1101,9 +1101,9 @@ bool SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surfac
     int dst_w, dst_h;
 
     // Make sure the surfaces aren't locked
-    if (!SDL_SurfaceValid(src)) {
+    if (!SDL_SurfaceValid(src) || !src->pixels) {
         return SDL_InvalidParamError("src");
-    } else if (!SDL_SurfaceValid(dst)) {
+    } else if (!SDL_SurfaceValid(dst) || !dst->pixels) {
         return SDL_InvalidParamError("dst");
     } else if ((src->flags & SDL_SURFACE_LOCKED) || (dst->flags & SDL_SURFACE_LOCKED)) {
         return SDL_SetError("Surfaces must not be locked during blit");