diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-03-16 14:28:45 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-03-16 14:28:45 +0200 |
commit | 59dc0bffc0f754de8daed29bce3a48e90ea6b4fb (patch) | |
tree | 7cd423679a60e25b29318d7a87f367729f8d5fdf /src/resources/emotedb.cpp | |
parent | fbf665912933d10d9132b17802949149d9094fdd (diff) | |
download | mv-59dc0bffc0f754de8daed29bce3a48e90ea6b4fb.tar.gz mv-59dc0bffc0f754de8daed29bce3a48e90ea6b4fb.tar.bz2 mv-59dc0bffc0f754de8daed29bce3a48e90ea6b4fb.tar.xz mv-59dc0bffc0f754de8daed29bce3a48e90ea6b4fb.zip |
Add checks and fix some code style.
Diffstat (limited to 'src/resources/emotedb.cpp')
-rw-r--r-- | src/resources/emotedb.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp index 5b20742a8..6084f6092 100644 --- a/src/resources/emotedb.cpp +++ b/src/resources/emotedb.cpp @@ -76,6 +76,9 @@ void EmoteDB::load() for_each_xml_child_node(spriteNode, emoteNode) { + if (!spriteNode->xmlChildrenNode) + continue; + if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite")) { EmoteSprite *currentSprite = new EmoteSprite; @@ -128,6 +131,9 @@ void EmoteDB::load() for_each_xml_child_node(spriteNode, emoteNode) { + if (!spriteNode->xmlChildrenNode) + continue; + if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite")) { EmoteSprite *currentSprite = new EmoteSprite; @@ -160,13 +166,16 @@ void EmoteDB::unload() i != mEmoteInfos.end(); ++i) { - while (!i->second->sprites.empty()) + if (i->second) { - delete i->second->sprites.front()->sprite; - delete i->second->sprites.front(); - i->second->sprites.pop_front(); + while (!i->second->sprites.empty()) + { + delete i->second->sprites.front()->sprite; + delete i->second->sprites.front(); + i->second->sprites.pop_front(); + } + delete i->second; } - delete i->second; } mEmoteInfos.clear(); |