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

This commit is contained in:
Petar Popovic 2025-04-19 17:29:51 +02:00 committed by Sam Lantinga
parent 18fbe6a92f
commit 8017d38adc
1 changed files with 2 additions and 2 deletions

View File

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