mirror of https://github.com/encounter/SDL.git
Raspberry: Fixed crash if memory allocation for cursor failed.
This commit is contained in:
parent
21d3297597
commit
05b6ca3c35
|
@ -70,7 +70,16 @@ RPI_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
|
||||||
SDL_assert(surface->pitch == surface->w * 4);
|
SDL_assert(surface->pitch == surface->w * 4);
|
||||||
|
|
||||||
cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
|
cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
|
||||||
|
if (cursor == NULL) {
|
||||||
|
SDL_OutOfMemory();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
curdata = (RPI_CursorData *) SDL_calloc(1, sizeof(*curdata));
|
curdata = (RPI_CursorData *) SDL_calloc(1, sizeof(*curdata));
|
||||||
|
if (curdata == NULL) {
|
||||||
|
SDL_OutOfMemory();
|
||||||
|
SDL_free(cursor);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
curdata->hot_x = hot_x;
|
curdata->hot_x = hot_x;
|
||||||
curdata->hot_y = hot_y;
|
curdata->hot_y = hot_y;
|
||||||
|
|
Loading…
Reference in New Issue