From 217ec76dfb113c7a00c14c7d7b4c0874f1bf62a7 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 30 Dec 2015 21:56:24 +0100 Subject: [PATCH] coverity findings: fix possible derefencing of null pointer. --- code/NFFLoader.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/NFFLoader.cpp b/code/NFFLoader.cpp index c96b7b1c4..17c91c83e 100644 --- a/code/NFFLoader.cpp +++ b/code/NFFLoader.cpp @@ -1139,8 +1139,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, mesh->mNumFaces = (unsigned int)src.faces.size(); // Generate sub nodes for named meshes - if (src.name[0]) - { + if ( src.name[ 0 ] && NULL != ppcChildren ) { aiNode* const node = *ppcChildren = new aiNode(); node->mParent = root; node->mNumMeshes = 1; @@ -1161,8 +1160,9 @@ void NFFImporter::InternReadFile( const std::string& pFile, mat.c4 = src.center.z; ++ppcChildren; - } - else *pMeshes++ = m; + } else { + *pMeshes++ = m; + } // copy vertex positions mesh->mVertices = new aiVector3D[mesh->mNumVertices];