diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-24 18:41:42 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-25 22:08:24 +0300 |
commit | d49a520d19f28c613c68b574686b182a9c0621be (patch) | |
tree | 5b6943125fd364eaaaaa295b45100cdfc473dd93 /src/resources/spritedef.cpp | |
parent | 14f55eb8c6e44763e70046b9661bd056280226a5 (diff) | |
download | manaplus-d49a520d19f28c613c68b574686b182a9c0621be.tar.gz manaplus-d49a520d19f28c613c68b574686b182a9c0621be.tar.bz2 manaplus-d49a520d19f28c613c68b574686b182a9c0621be.tar.xz manaplus-d49a520d19f28c613c68b574686b182a9c0621be.zip |
Add missing checks into resources directory.
Diffstat (limited to 'src/resources/spritedef.cpp')
-rw-r--r-- | src/resources/spritedef.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index 9dae7289e..20d0537d1 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -185,10 +185,16 @@ void SpriteDef::substituteActions() substituteAction(SpriteAction::DEADRIDE, SpriteAction::DEAD); } -void SpriteDef::loadSprite(const XmlNodePtr spriteNode, const int variant, +void SpriteDef::loadSprite(const XmlNodePtr spriteNode, + const int variant, const std::string &palettes) { BLOCK_START("SpriteDef::loadSprite") + if (!spriteNode) + { + BLOCK_END("SpriteDef::loadSprite") + return; + } // Get the variant const int variantCount = XML::getProperty(spriteNode, "variants", 0); int variant_offset = 0; @@ -243,6 +249,9 @@ void SpriteDef::loadImageSet(const XmlNodePtr node, void SpriteDef::loadAction(const XmlNodePtr node, const int variant_offset) { + if (!node) + return; + const std::string actionName = XML::getProperty(node, "name", ""); const std::string imageSetName = XML::getProperty(node, "imageset", ""); const unsigned hp = XML::getProperty(node, "hp", 100); @@ -288,7 +297,7 @@ void SpriteDef::loadAnimation(const XmlNodePtr animationNode, const ImageSet *const imageSet, const int variant_offset) const { - if (!action || !imageSet) + if (!action || !imageSet || !animationNode) return; const std::string directionName = |