فهرست منبع

3MF: fix nullptr access.

Kim Kulling 9 سال پیش
والد
کامیت
bac28061ea
1فایلهای تغییر یافته به همراه10 افزوده شده و 2 حذف شده
  1. 10 2
      code/D3MFImporter.cpp

+ 10 - 2
code/D3MFImporter.cpp

@@ -148,8 +148,16 @@ private:
 
 
         std::vector<unsigned long> meshIds;
         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->mParent = scene->mRootNode;
         node->mName.Set(name);
         node->mName.Set(name);