Browse Source

AssbinLoader: fix setting mNumChildren and releasing the smart pointer

Martin Jeřábek 6 years ago
parent
commit
770356a55b
1 changed files with 2 additions and 1 deletions
  1. 2 1
      code/AssbinLoader.cpp

+ 2 - 1
code/AssbinLoader.cpp

@@ -241,9 +241,9 @@ void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** onode, aiNode*
         node->mChildren = new aiNode*[numChildren];
         node->mChildren = new aiNode*[numChildren];
         for (unsigned int i = 0; i < numChildren; ++i) {
         for (unsigned int i = 0; i < numChildren; ++i) {
             ReadBinaryNode( stream, &node->mChildren[i], node.get() );
             ReadBinaryNode( stream, &node->mChildren[i], node.get() );
+            node->mNumChildren++;
         }
         }
     }
     }
-    *onode = node.release();
 
 
     if ( nb_metadata > 0 ) {
     if ( nb_metadata > 0 ) {
         node->mMetaData = aiMetadata::Alloc(nb_metadata);
         node->mMetaData = aiMetadata::Alloc(nb_metadata);
@@ -284,6 +284,7 @@ void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** onode, aiNode*
 			node->mMetaData->mValues[i].mData = data;
 			node->mMetaData->mValues[i].mData = data;
 		}
 		}
 	}
 	}
+    *onode = node.release();
 }
 }
 
 
 // -----------------------------------------------------------------------------------
 // -----------------------------------------------------------------------------------