diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-25 21:41:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-31 23:06:29 +0300 |
commit | f0d5be2db32afc7b4382276ffa3c60a1354bea8e (patch) | |
tree | 919fc1db442339a32a88bde0fa6f68e320e64dce /src/map/npc.c | |
parent | a71a056abb8931aa4a11d0cde296fe9de68ee6df (diff) | |
download | hercules-f0d5be2db32afc7b4382276ffa3c60a1354bea8e.tar.gz hercules-f0d5be2db32afc7b4382276ffa3c60a1354bea8e.tar.bz2 hercules-f0d5be2db32afc7b4382276ffa3c60a1354bea8e.tar.xz hercules-f0d5be2db32afc7b4382276ffa3c60a1354bea8e.zip |
Add some missing null pointer checks after automatic checks.
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index 8b5bbc83e..2da99c0bd 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2308,16 +2308,18 @@ int npc_unload(struct npc_data* nd, bool single) { aFree(nd->ud); nd->ud = NULL; } - - for( i = 0; i < nd->hdatac; i++ ) { - if( nd->hdata[i]->flag.free ) { - aFree(nd->hdata[i]->data); - } - aFree(nd->hdata[i]); - } + if( nd->hdata ) + { + for( i = 0; i < nd->hdatac; i++ ) { + if( nd->hdata[i]->flag.free ) { + aFree(nd->hdata[i]->data); + } + aFree(nd->hdata[i]); + } aFree(nd->hdata); - + } + aFree(nd); return 0; |