3MF: fix nullptr access.
authorKim Kulling <kim.kulling@googlemail.com>
Tue, 18 Oct 2016 19:16:44 +0000 (21:16 +0200)
committerKim Kulling <kim.kulling@googlemail.com>
Tue, 18 Oct 2016 19:16:44 +0000 (21:16 +0200)
code/D3MFImporter.cpp

index 98afb7d..74eebb7 100644 (file)
@@ -148,8 +148,16 @@ private:
 
         std::vector<unsigned long> meshIds;
 
-        std::string name(xmlReader->getAttributeValue(D3MF::XmlTag::name.c_str()));
-        std::string type(xmlReader->getAttributeValue(D3MF::XmlTag::type.c_str()));
+        const char *attrib( nullptr );
+        std::string name, type;
+        attrib = xmlReader->getAttributeValue( D3MF::XmlTag::name.c_str() );
+        if ( nullptr != attrib ) {
+            name = attrib;
+        }
+        attrib = xmlReader->getAttributeValue( D3MF::XmlTag::name.c_str() );
+        if ( nullptr != attrib ) {
+            type = attrib;
+        }
 
         node->mParent = scene->mRootNode;
         node->mName.Set(name);