Parcourir la source

iSIBImporter: fix possible dereferncing of a null pointer.

Kim Kulling il y a 9 ans
Parent
commit
1acd24e0ae
1 fichiers modifiés avec 6 ajouts et 4 suppressions
  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++)
     for (size_t n=0;n<sib.lights.size();n++)
     {
     {
         aiLight* light = sib.lights[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;
+        }
     }
     }
 }
 }