mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-04 22:55:09 +08:00
Fixed crash if the animated cursor had a NULL frame 0
This commit is contained in:
@@ -1562,6 +1562,11 @@ SDL_Cursor *SDL_CreateAnimatedCursor(SDL_CursorFrameInfo *frames, int frame_coun
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CHECK_PARAM(!frames[0].surface) {
|
||||||
|
SDL_SetError("Null surface in frame 0");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
CHECK_PARAM(!frame_count) {
|
CHECK_PARAM(!frame_count) {
|
||||||
SDL_InvalidParamError("frame_count");
|
SDL_InvalidParamError("frame_count");
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1591,11 +1596,6 @@ SDL_Cursor *SDL_CreateAnimatedCursor(SDL_CursorFrameInfo *frames, int frame_coun
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_PARAM(!frames[0].surface) {
|
|
||||||
SDL_SetError("Null surface in frame 0");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isstack;
|
bool isstack;
|
||||||
SDL_CursorFrameInfo *temp_frames = SDL_small_alloc(SDL_CursorFrameInfo, frame_count, &isstack);
|
SDL_CursorFrameInfo *temp_frames = SDL_small_alloc(SDL_CursorFrameInfo, frame_count, &isstack);
|
||||||
if (!temp_frames) {
|
if (!temp_frames) {
|
||||||
|
|||||||
Reference in New Issue
Block a user