Skip to content

Commit 8e1cc30

Browse files
committed
error checking of SDL_CreateRGBSurface()
fixes #29
1 parent 84a7503 commit 8e1cc30

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ngiflibSDL.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ struct ngiflibSDL_animation * SDL_LoadAnimatedGif(const char * file)
176176
surface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCCOLORKEY,
177177
gif->width, gif->height, 8,
178178
0,0,0,0);
179+
if (surface == NULL) {
180+
fprintf(stderr, "SDL_CreateRGBSurface(..., %d, %d, 8, ...) failed : %s\n", gif->width, gif->height, SDL_GetError());
181+
continue;
182+
}
179183
SDL_LockSurface(surface);
180184
/*
181185
if(gif->transparent_flag) {

0 commit comments

Comments
 (0)