Skip to content

Instantly share code, notes, and snippets.

@DrMcCoy
Created August 17, 2016 22:59
Show Gist options
  • Save DrMcCoy/9f629e4c6b9481a043d154d938398261 to your computer and use it in GitHub Desktop.
Save DrMcCoy/9f629e4c6b9481a043d154d938398261 to your computer and use it in GitHub Desktop.
diff --git a/src/graphics/aurora/model_nwn.cpp b/src/graphics/aurora/model_nwn.cpp
index e302100..1eaf052 100644
--- a/src/graphics/aurora/model_nwn.cpp
+++ b/src/graphics/aurora/model_nwn.cpp
@@ -392,6 +392,12 @@ void Model_NWN::addState(ParserContext &ctx) {
return;
}
+ if (_stateMap.find(ctx.state->name) != _stateMap.end()) {
+ warning("Duplicate state \"%s\" in model \"%s\"", ctx.state->name.c_str(), _name.c_str());
+ ctx.clear();
+ return;
+ }
+
for (std::list<ModelNode *>::iterator n = ctx.nodes.begin();
n != ctx.nodes.end(); ++n) {
@@ -420,6 +426,11 @@ void Model_NWN::readAnimBinary(ParserContext &ctx, uint32 offset) {
ctx.state->name = Common::readStringFixed(*ctx.mdl, Common::kEncodingASCII, 64);
+ if (_animationMap.find(ctx.state->name) != _animationMap.end()) {
+ warning("Duplicate animation \"%s\" in model \"%s\"", ctx.state->name.c_str(), _name.c_str());
+ return;
+ }
+
uint32 nodeHeadPointer = ctx.mdl->readUint32LE();
uint32 nodeCount = ctx.mdl->readUint32LE();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment