From bac28061ea2d9e3625a8928674573e4628ab91af Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 18 Oct 2016 21:16:44 +0200 Subject: [PATCH] 3MF: fix nullptr access. --- code/D3MFImporter.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/code/D3MFImporter.cpp b/code/D3MFImporter.cpp index 98afb7d..74eebb7 100644 --- a/code/D3MFImporter.cpp +++ b/code/D3MFImporter.cpp @@ -148,8 +148,16 @@ private: std::vector meshIds; - std::string name(xmlReader->getAttributeValue(D3MF::XmlTag::name.c_str())); - std::string type(xmlReader->getAttributeValue(D3MF::XmlTag::type.c_str())); + const char *attrib( nullptr ); + std::string name, type; + attrib = xmlReader->getAttributeValue( D3MF::XmlTag::name.c_str() ); + if ( nullptr != attrib ) { + name = attrib; + } + attrib = xmlReader->getAttributeValue( D3MF::XmlTag::name.c_str() ); + if ( nullptr != attrib ) { + type = attrib; + } node->mParent = scene->mRootNode; node->mName.Set(name); -- 2.7.4