From 1026264c64304e78c4e7ae80f6da46a7a0ca9653 Mon Sep 17 00:00:00 2001 From: Leo Terziman Date: Tue, 11 Jul 2017 18:15:56 +0200 Subject: [PATCH] Fixed bug in assbin metadata export when no metadata are defined --- code/AssbinExporter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/AssbinExporter.cpp b/code/AssbinExporter.cpp index 5735c92..4a19147 100644 --- a/code/AssbinExporter.cpp +++ b/code/AssbinExporter.cpp @@ -325,11 +325,13 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size) { AssbinChunkWriter chunk( container, ASSBIN_CHUNK_AINODE ); + size_t nb_metadata = (node->mMetaData != NULL ? node->mMetaData->mNumProperties : 0); + Write(&chunk,node->mName); Write(&chunk,node->mTransformation); Write(&chunk,node->mNumChildren); Write(&chunk,node->mNumMeshes); - Write(&chunk,node->mMetaData->mNumProperties); + Write(&chunk,nb_metadata); for (unsigned int i = 0; i < node->mNumMeshes;++i) { Write(&chunk,node->mMeshes[i]); @@ -339,7 +341,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size) WriteBinaryNode( &chunk, node->mChildren[i] ); } - for (unsigned int i = 0; i < node->mMetaData->mNumProperties; ++i) { + for (unsigned int i = 0; i < nb_metadata; ++i) { const aiString& key = node->mMetaData->mKeys[i]; aiMetadataType type = node->mMetaData->mValues[i].mType; void* value = node->mMetaData->mValues[i].mData; -- 2.7.4