From 170fc1642e865ba47d011a8172b6ed9fa5cb5f0d Mon Sep 17 00:00:00 2001 From: Shon Ferguson <shonferg@users.sourceforge.net> Date: Mon, 11 Jun 2007 05:12:01 +0000 Subject: [PATCH] It seems that a NIF file with NULL property links is still able to be opened by the game engine, so added tests for this in a few places rather than assuming that all links are not NULL. --- niflib.vcproj | 1 + src/MatTexCollection.cpp | 3 +++ src/obj/NiAVObject.cpp | 3 +++ 3 files changed, 7 insertions(+) diff --git a/niflib.vcproj b/niflib.vcproj index f45255f7..09202084 100644 --- a/niflib.vcproj +++ b/niflib.vcproj @@ -269,6 +269,7 @@ Name="VCLinkerTool" OutputFile="bin\niflib_debug.dll" Version="0.7.2" + GenerateDebugInformation="true" ImportLibrary="lib/niflib_dll_debug.lib" /> <Tool diff --git a/src/MatTexCollection.cpp b/src/MatTexCollection.cpp index 3dec9ed1..a8ae354d 100644 --- a/src/MatTexCollection.cpp +++ b/src/MatTexCollection.cpp @@ -188,6 +188,9 @@ unsigned int MatTexCollection::GetMaterialIndex( const vector< Ref<NiProperty> > NiAlphaPropertyRef alpha = NULL; for ( unsigned i = 0; i < properties.size(); ++i ) { + if ( properties[i] == NULL ) { + continue; + } if ( properties[i]->IsDerivedType( NiMaterialProperty::TYPE ) ) { mat = DynamicCast<NiMaterialProperty>( properties[i] ); } else if ( properties[i]->IsDerivedType( NiTexturingProperty::TYPE ) ) { diff --git a/src/obj/NiAVObject.cpp b/src/obj/NiAVObject.cpp index 417d18a9..d83a7be9 100644 --- a/src/obj/NiAVObject.cpp +++ b/src/obj/NiAVObject.cpp @@ -261,6 +261,9 @@ vector< Ref<NiProperty> > NiAVObject::GetProperties() const { Ref<NiProperty> NiAVObject::GetPropertyByType( const Type & compare_to ) { for ( unsigned int i = 0; i < properties.size(); ++i ) { + if ( properties[i] == NULL ) { + continue; + } if ( properties[i]->IsSameType( compare_to ) ) { return properties[i]; } -- GitLab