diff options
author | shennetsind <ind@henn.et> | 2013-12-09 20:28:19 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-12-09 20:28:19 -0200 |
commit | b4136dd3d4779d80df18f84929c576c8080cd7b8 (patch) | |
tree | d38885e73698210ea2411093db594f8f2ebd42ea /src/map/npc.c | |
parent | 4727cc95528be094cd2c1c3fbb3c92b7873c809b (diff) | |
download | hercules-b4136dd3d4779d80df18f84929c576c8080cd7b8.tar.gz hercules-b4136dd3d4779d80df18f84929c576c8080cd7b8.tar.bz2 hercules-b4136dd3d4779d80df18f84929c576c8080cd7b8.tar.xz hercules-b4136dd3d4779d80df18f84929c576c8080cd7b8.zip |
Fixed some logic errors
Special Thanks to Haru
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index 5f890c65b..b57627495 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3148,7 +3148,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char int savex, savey; if (state == 0) ; //Map flag disabled. - else if (!strcmpi(w4, "SavePoint")) { + else if (w4 && !strcmpi(w4, "SavePoint")) { map->list[m].save.map = 0; map->list[m].save.x = -1; map->list[m].save.y = -1; @@ -3370,10 +3370,11 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char else if (!strcmpi(w3,"adjust_unit_duration")) { int skill_id, k; char skill_name[MAP_ZONE_MAPFLAG_LENGTH], modifier[MAP_ZONE_MAPFLAG_LENGTH]; - int len = strlen(w4); + int len = w4 ? strlen(w4) : 0; modifier[0] = '\0'; - memcpy(skill_name, w4, MAP_ZONE_MAPFLAG_LENGTH); + if( w4 ) + memcpy(skill_name, w4, MAP_ZONE_MAPFLAG_LENGTH); for(k = 0; k < len; k++) { if( skill_name[k] == '\t' ) { @@ -3424,10 +3425,12 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char } else if (!strcmpi(w3,"adjust_skill_damage")) { int skill_id, k; char skill_name[MAP_ZONE_MAPFLAG_LENGTH], modifier[MAP_ZONE_MAPFLAG_LENGTH]; - int len = strlen(w4); + int len = w4 ? strlen(w4) : 0; modifier[0] = '\0'; - memcpy(skill_name, w4, MAP_ZONE_MAPFLAG_LENGTH); + + if( w4 ) + memcpy(skill_name, w4, MAP_ZONE_MAPFLAG_LENGTH); for(k = 0; k < len; k++) { if( skill_name[k] == '\t' ) { |