Revision: 48432
          http://brlcad.svn.sourceforge.net/brlcad/?rev=48432&view=rev
Author:   indianlarry
Date:     2012-01-11 20:13:42 +0000 (Wed, 11 Jan 2012)
Log Message:
-----------
Now getting last element in Std::List by using "data.segments.back()" (after 
check to make sure list is not empty) instead of misusing  iterator 
"data.segments.end()" walking past the end of its container. Relates to Run 5 
CID 1851.

Modified Paths:
--------------
    brlcad/trunk/src/conv/step/PullbackCurve.cpp

Modified: brlcad/trunk/src/conv/step/PullbackCurve.cpp
===================================================================
--- brlcad/trunk/src/conv/step/PullbackCurve.cpp        2012-01-11 20:00:51 UTC 
(rev 48431)
+++ brlcad/trunk/src/conv/step/PullbackCurve.cpp        2012-01-11 20:13:42 UTC 
(rev 48432)
@@ -278,14 +278,17 @@
 {
     ON_2dPoint m;
     double t = randomPointFromRange(data, m, t1, t2);
-    ON_2dPointArray * samples = (*data.segments.end());
-    if (isFlat(p1, m, p2, data.flatness)) {
-       samples->Append(p2);
-    } else {
-       sample(data, t1, t, p1, m);
-       sample(data, t, t2, m, p2);
+    if (!data.segments.empty()) {
+       ON_2dPointArray * samples = data.segments.back();
+       if (isFlat(p1, m, p2, data.flatness)) {
+           samples->Append(p2);
+       } else {
+           sample(data, t1, t, p1, m);
+           sample(data, t, t2, m, p2);
+       }
+       return true;
     }
-    return true;
+    return false;
 }
 
 

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


------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to