From abffe3180447de0c1479b282b5b972eaf103f9be Mon Sep 17 00:00:00 2001 From: Shon Ferguson <shonferg@users.sourceforge.net> Date: Sat, 24 Jun 2006 14:55:29 +0000 Subject: [PATCH] Fixed problem with dropping refs with the same name in two places. --- gen/obj_impl.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gen/obj_impl.cpp b/gen/obj_impl.cpp index f064ec56..de340f72 100644 --- a/gen/obj_impl.cpp +++ b/gen/obj_impl.cpp @@ -5127,6 +5127,7 @@ void NiControllerSequence::InternalRead( istream& in, list<uint> & link_stack, u if ( version >= 0x0A01006A ) { NifStream( weight, in, version ); NifStream( block_num, in, version ); + link_stack.push_back( block_num ); NifStream( cycleType, in, version ); }; if ( ( version >= 0x0A01006A ) && ( version <= 0x0A01006A ) ) { @@ -5392,6 +5393,15 @@ void NiControllerSequence::InternalFixLinks( const vector<NiObjectRef> & objects }; }; if ( version >= 0x0A01006A ) { + if (link_stack.empty()) + throw runtime_error("Trying to pop a link from empty stack. This is probably a bug."); + if (link_stack.front() != 0xffffffff) { + textKeys = DynamicCast<NiTextKeyExtraData>(objects[link_stack.front()]); + if ( textKeys == NULL ) + throw runtime_error("Link could not be cast to required type during file read. This NIF file may be invalid or improperly understood."); + } else + textKeys = NULL; + link_stack.pop_front(); if (link_stack.empty()) throw runtime_error("Trying to pop a link from empty stack. This is probably a bug."); if (link_stack.front() != 0xffffffff) { -- GitLab