]> git.jsancho.org Git - c-irrlicht.git/commitdiff
Source rect for begin scene can be NULL
authorJavier Sancho <jsf@jsancho.org>
Tue, 8 Oct 2019 10:24:49 +0000 (12:24 +0200)
committerJavier Sancho <jsf@jsancho.org>
Tue, 8 Oct 2019 10:24:49 +0000 (12:24 +0200)
src/IVideoDriver.cpp

index 517275d973d7350b62789a4238ff847b44c4a34b..86d7347b31e7e5baf832f50f7b4957524c478f22 100644 (file)
@@ -38,18 +38,21 @@ extern "C" {
     irr::video::SExposedVideoData vdata = irr::video::SExposedVideoData();
 
     // Source rect
-    irr::core::rect<irr::s32> rect =            \
-      irr::core::rect<irr::s32>(sourceRect->x,
-                                sourceRect->y,
-                                sourceRect->x2,
-                                sourceRect->y2);
+    irr::core::rect<irr::s32> rect;
+    if (sourceRect != NULL)
+      {
+        rect = irr::core::rect<irr::s32>(sourceRect->x,
+                                         sourceRect->y,
+                                         sourceRect->x2,
+                                         sourceRect->y2);
+      }
 
     // Begin scene
     return ((irr::video::IVideoDriver*)driver)->beginScene(backBuffer,
-                                                          zBuffer,
-                                                          col,
-                                                          vdata,
-                                                          &rect);
+                                                           zBuffer,
+                                                           col,
+                                                           vdata,
+                                                           sourceRect != NULL ? &rect : 0);
   }
 
   bool irr_video_IVideoDriver_endScene(void* driver)