Fixed bug #457
Don't crash if passed a NULL overlay. The app crashes anyway, since it's not checking the return value of the create call, but at least it's not crashing in SDL anymore. :) --HG-- branch : SDL-1.2 extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402543
This commit is contained in:
parent
5adb9f2f7e
commit
be91b51038
1 changed files with 18 additions and 5 deletions
|
@ -65,11 +65,18 @@ SDL_Overlay *SDL_CreateYUVOverlay(int w, int h, Uint32 format,
|
||||||
|
|
||||||
int SDL_LockYUVOverlay(SDL_Overlay *overlay)
|
int SDL_LockYUVOverlay(SDL_Overlay *overlay)
|
||||||
{
|
{
|
||||||
|
if ( overlay == NULL ) {
|
||||||
|
SDL_SetError("Passed NULL overlay");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return overlay->hwfuncs->Lock(current_video, overlay);
|
return overlay->hwfuncs->Lock(current_video, overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_UnlockYUVOverlay(SDL_Overlay *overlay)
|
void SDL_UnlockYUVOverlay(SDL_Overlay *overlay)
|
||||||
{
|
{
|
||||||
|
if ( overlay == NULL ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
overlay->hwfuncs->Unlock(current_video, overlay);
|
overlay->hwfuncs->Unlock(current_video, overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +86,11 @@ int SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect)
|
||||||
int srcx, srcy, srcw, srch;
|
int srcx, srcy, srcw, srch;
|
||||||
int dstx, dsty, dstw, dsth;
|
int dstx, dsty, dstw, dsth;
|
||||||
|
|
||||||
|
if ( overlay == NULL || dstrect == NULL ) {
|
||||||
|
SDL_SetError("Passed NULL overlay or dstrect");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Clip the rectangle to the screen area */
|
/* Clip the rectangle to the screen area */
|
||||||
srcx = 0;
|
srcx = 0;
|
||||||
srcy = 0;
|
srcy = 0;
|
||||||
|
@ -128,10 +140,11 @@ int SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect)
|
||||||
|
|
||||||
void SDL_FreeYUVOverlay(SDL_Overlay *overlay)
|
void SDL_FreeYUVOverlay(SDL_Overlay *overlay)
|
||||||
{
|
{
|
||||||
if ( overlay ) {
|
if ( overlay == NULL ) {
|
||||||
if ( overlay->hwfuncs ) {
|
return;
|
||||||
overlay->hwfuncs->FreeHW(current_video, overlay);
|
|
||||||
}
|
|
||||||
SDL_free(overlay);
|
|
||||||
}
|
}
|
||||||
|
if ( overlay->hwfuncs ) {
|
||||||
|
overlay->hwfuncs->FreeHW(current_video, overlay);
|
||||||
|
}
|
||||||
|
SDL_free(overlay);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue