From 2dc1a594714ddc688b7403b4ef96eb41301055ae Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 20 May 2019 09:44:45 +0200 Subject: [PATCH] Check surface returned for icon SDL_CreateRGBSurfaceFrom() may return NULL, causing a segfault. --- app/src/tiny_xpm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/tiny_xpm.c b/app/src/tiny_xpm.c index 01fd280f..0fb410f3 100644 --- a/app/src/tiny_xpm.c +++ b/app/src/tiny_xpm.c @@ -105,6 +105,10 @@ read_xpm(char *xpm[]) { width, height, 32, 4 * width, rmask, gmask, bmask, amask); + if (!surface) { + LOGE("Could not create icon surface"); + return NULL; + } // make the surface own the raw pixels surface->flags &= ~SDL_PREALLOC; return surface;