Check surface returned for icon
SDL_CreateRGBSurfaceFrom() may return NULL, causing a segfault. <https://github.com/Genymobile/scrcpy/issues/539>
This commit is contained in:
parent
e443518ed9
commit
2dc1a59471
1 changed files with 4 additions and 0 deletions
|
@ -105,6 +105,10 @@ read_xpm(char *xpm[]) {
|
||||||
width, height,
|
width, height,
|
||||||
32, 4 * width,
|
32, 4 * width,
|
||||||
rmask, gmask, bmask, amask);
|
rmask, gmask, bmask, amask);
|
||||||
|
if (!surface) {
|
||||||
|
LOGE("Could not create icon surface");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
// make the surface own the raw pixels
|
// make the surface own the raw pixels
|
||||||
surface->flags &= ~SDL_PREALLOC;
|
surface->flags &= ~SDL_PREALLOC;
|
||||||
return surface;
|
return surface;
|
||||||
|
|
Loading…
Reference in a new issue