Code

Fix for crash 409043
authorscislac <scislac@users.sourceforge.net>
Sun, 8 Nov 2009 01:09:47 +0000 (01:09 +0000)
committerscislac <scislac@users.sourceforge.net>
Sun, 8 Nov 2009 01:09:47 +0000 (01:09 +0000)
src/box3d-side.cpp

index 241279100a8bee0e7b6bfc8033d5275cd3c1b904..69bae53d93b696fb1f362d85b7ac2bee9650a1f3 100644 (file)
@@ -225,6 +225,16 @@ box3d_side_set_shape (SPShape *shape)
     box3d_side_compute_corner_ids(side, corners);
 
     SPCurve *c = new SPCurve();
+
+    if (!box3d_get_corner_screen(box, corners[0]).isFinite() ||
+        !box3d_get_corner_screen(box, corners[1]).isFinite() ||
+        !box3d_get_corner_screen(box, corners[2]).isFinite() ||
+        !box3d_get_corner_screen(box, corners[3]).isFinite() )
+    {
+        g_warning ("Trying to draw a 3D box side with invalid coordinates.\n");
+        return;
+    }
+
     c->moveto(box3d_get_corner_screen(box, corners[0]));
     c->lineto(box3d_get_corner_screen(box, corners[1]));
     c->lineto(box3d_get_corner_screen(box, corners[2]));