Merge pull request #2057 from assimp/issue_1340

closes https://github.com/assimp/assimp/issues/1340: Fix handling of …
pull/1878/head^2
Kim Kulling 2018-07-11 14:16:35 +02:00 committed by GitHub
commit 3c6ba8162b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 0 deletions

View File

@ -100,10 +100,16 @@ static bool isUnsignedIntegerType( Value::ValueType integerType ) {
} }
static DDLNode *createDDLNode( Text *id, OpenDDLParser *parser ) { static DDLNode *createDDLNode( Text *id, OpenDDLParser *parser ) {
// Basic checks
if( ddl_nullptr == id || ddl_nullptr == parser ) { if( ddl_nullptr == id || ddl_nullptr == parser ) {
return ddl_nullptr; return ddl_nullptr;
} }
// If the buffer is empty ( an empty node ) return nullptr
if ( ddl_nullptr == id->m_buffer ) {
return ddl_nullptr;
}
const std::string type( id->m_buffer ); const std::string type( id->m_buffer );
DDLNode *parent( parser->top() ); DDLNode *parent( parser->top() );
DDLNode *node = DDLNode::create( type, "", parent ); DDLNode *node = DDLNode::create( type, "", parent );

View File

@ -0,0 +1,7 @@
CameraObject {
Param (attrib = "fov") { float { 0.97 } }
Param (attrib = "near") { float { 1.5 } }
Param (attrib = "far") { float { 150.0 } }
}
CameraObject {}

View File

@ -68,3 +68,9 @@ TEST_F( utOpenGEXImportExport, Importissue1262_NoCrash ) {
EXPECT_NE( nullptr, scene ); EXPECT_NE( nullptr, scene );
} }
TEST_F(utOpenGEXImportExport, Importissue1340_EmptyCameraObject) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/OpenGEX/empty_camera.ogex", 0);
EXPECT_NE(nullptr, scene);
}