فهرست منبع

iSIBImporter: fix possible dereferncing of a null pointer.

Kim Kulling 9 سال پیش
والد
کامیت
1acd24e0ae
1فایلهای تغییر یافته به همراه6 افزوده شده و 4 حذف شده
  1. 6 4
      code/SIBImporter.cpp

+ 6 - 4
code/SIBImporter.cpp

@@ -914,10 +914,12 @@ void SIBImporter::InternReadFile(const std::string& pFile,
     for (size_t n=0;n<sib.lights.size();n++)
     {
         aiLight* light = sib.lights[n];
-        aiNode* node = new aiNode;
-        root->mChildren[childIdx++] = node;
-        node->mName = light->mName;
-        node->mParent = root;
+        if ( nullptr != light ) {
+            aiNode* node = new aiNode;
+            root->mChildren[ childIdx++ ] = node;
+            node->mName = light->mName;
+            node->mParent = root;
+        }
     }
 }