Revision: 52644
          http://brlcad.svn.sourceforge.net/brlcad/?rev=52644&view=rev
Author:   brlcad
Date:     2012-10-01 22:51:27 +0000 (Mon, 01 Oct 2012)
Log Message:
-----------
prevent a crash if we're presented with an empty sketch

Modified Paths:
--------------
    brlcad/trunk/src/librt/primitives/revolve/revolve.c

Modified: brlcad/trunk/src/librt/primitives/revolve/revolve.c
===================================================================
--- brlcad/trunk/src/librt/primitives/revolve/revolve.c 2012-10-01 21:18:13 UTC 
(rev 52643)
+++ brlcad/trunk/src/librt/primitives/revolve/revolve.c 2012-10-01 22:51:27 UTC 
(rev 52644)
@@ -1273,10 +1273,9 @@
     VREVERSE(ucir[12], ucir[4]);
 
     /* find open endpoints, and determine which points are used */
-    endcount = (int *)bu_calloc(rip->skt->vert_count, sizeof(int), "endcount");
-    for (i=0; i<rip->skt->vert_count; i++) {
-       endcount[i] = 0;
-    }
+    if (nvert)
+       endcount = (int *)bu_calloc(nvert, sizeof(int), "endcount");
+
     nseg = rip->skt->curve.count;
 
     for (i=0; i<nseg; i++) {
@@ -1356,7 +1355,9 @@
        }
     }
     nadd = j;
-    while (j < rip->skt->vert_count) endcount[j++] = -1;
+    while (j < rip->skt->vert_count) {
+       endcount[j++] = -1;
+    }
 
     /* draw sketch outlines */
     for (i=0; i<narc; i++) {
@@ -1406,7 +1407,8 @@
        }
     }
 
-    bu_free(endcount, "endcount");
+    if (nvert)
+       bu_free(endcount, "endcount");
     return 0;
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to