Revision: 52932
          http://brlcad.svn.sourceforge.net/brlcad/?rev=52932&view=rev
Author:   brlcad
Date:     2012-10-10 06:44:35 +0000 (Wed, 10 Oct 2012)
Log Message:
-----------
the entityname can be NULL if we're parsing entities not supported by our 
parser's schema (e.g., reading a 214 with a 203), so protect against trying to 
create a NULL std::string (throws exception) and bail early.

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

Modified: brlcad/trunk/src/conv/step/Factory.cpp
===================================================================
--- brlcad/trunk/src/conv/step/Factory.cpp      2012-10-10 05:40:44 UTC (rev 
52931)
+++ brlcad/trunk/src/conv/step/Factory.cpp      2012-10-10 06:44:35 UTC (rev 
52932)
@@ -74,7 +74,14 @@
 STEPEntity *
 Factory::CreateObject(STEPWrapper *sw, SDAI_Application_instance *sse)
 {
-    std::string methodname = std::string(sse->EntityName());
+    if (!sse)
+       return NULL;
+
+    const char *entityname = sse->EntityName();
+    if (!entityname)
+       return NULL;
+
+    std::string methodname = std::string(entityname);
     FACTORYMAP &methodmap = GetMap();
     FactoryMethod f = NULL;
     FACTORYMAP::iterator i;
@@ -140,7 +147,14 @@
 STEPEntity *
 Factory::CreateCurveObject(STEPWrapper *sw, SDAI_Application_instance *sse)
 {
-    string methodname = sse->EntityName();
+    if (!sse)
+       return NULL;
+
+    const char *entityname = sse->EntityName();
+    if (!entityname)
+       return NULL;
+
+    string methodname = std::string(entityname);
     FACTORYMAP &methodmap = GetMap();
     FactoryMethod f = NULL;
     FACTORYMAP::iterator i;
@@ -211,7 +225,14 @@
 STEPEntity *
 Factory::CreateNamedUnitObject(STEPWrapper *sw, SDAI_Application_instance *sse)
 {
-    string methodname = sse->EntityName();
+    if (!sse)
+       return NULL;
+
+    const char *entityname = sse->EntityName();
+    if (!entityname)
+       return NULL;
+
+    string methodname = std::string(entityname);
     FACTORYMAP &methodmap = GetMap();
     FactoryMethod f = NULL;
     FACTORYMAP::iterator i;
@@ -560,7 +581,14 @@
 STEPEntity *
 Factory::CreateSurfaceObject(STEPWrapper *sw, SDAI_Application_instance *sse)
 {
-    string methodname = sse->EntityName();
+    if (!sse)
+       return NULL;
+
+    const char *entityname = sse->EntityName();
+    if (!entityname)
+       return NULL;
+
+    string methodname = std::string(entityname);
     FACTORYMAP &methodmap = GetMap();
     FactoryMethod f = NULL;
     FACTORYMAP::iterator i;
@@ -631,7 +659,14 @@
 STEPEntity *
 Factory::CreateShapeRepresentationRelationshipObject(STEPWrapper *sw, 
SDAI_Application_instance *sse)
 {
-       string methodname = sse->EntityName();
+    if (!sse)
+       return NULL;
+
+    const char *entityname = sse->EntityName();
+    if (!entityname)
+       return NULL;
+
+    string methodname = std::string(entityname);
        FACTORYMAP &methodmap = GetMap();
        FactoryMethod f = NULL;
        FACTORYMAP::iterator i;
@@ -662,7 +697,14 @@
 STEPEntity *
 Factory::CreateRepresentationContext(STEPWrapper *sw, 
SDAI_Application_instance *sse)
 {
-       string methodname = sse->EntityName();
+    if (!sse)
+       return NULL;
+
+    const char *entityname = sse->EntityName();
+    if (!entityname)
+       return NULL;
+
+    string methodname = std::string(entityname);
        FACTORYMAP &methodmap = GetMap();
        FactoryMethod f = NULL;
        FACTORYMAP::iterator i;

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


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to