Drop out of SDL_UpdateTexture() early if the rectangle is zero pixels.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 26 May 2015 16:42:36 -0400
changeset 9636 ac8cd6c6d966
parent 9635 564b57497f2b
child 9637 adf81fe554b9
Drop out of SDL_UpdateTexture() early if the rectangle is zero pixels. Hopefully makes static analysis happy about a zero-byte malloc elsewhere.
src/render/SDL_render.c
--- a/src/render/SDL_render.c	Tue May 26 16:31:11 2015 -0400
+++ b/src/render/SDL_render.c	Tue May 26 16:42:36 2015 -0400
@@ -820,7 +820,9 @@
         rect = &full_rect;
     }
 
-    if (texture->yuv) {
+    if ((rect->w == 0) || (rect->h == 0)) {
+        return 0;  /* nothing to do. */
+    } else if (texture->yuv) {
         return SDL_UpdateTextureYUV(texture, rect, pixels, pitch);
     } else if (texture->native) {
         return SDL_UpdateTextureNative(texture, rect, pixels, pitch);