summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 28709d34f..8ecefb5a0 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -3605,7 +3605,8 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st
}
if (mobspawn.num > db->spawn[i].qty) {
//Insert into list
- memmove(&db->spawn[i+1], &db->spawn[i], sizeof(db->spawn) -(i+1)*sizeof(db->spawn[0]));
+ if( i != ARRAYLENGTH(db->spawn) - 1 )
+ memmove(&db->spawn[i+1], &db->spawn[i], sizeof(db->spawn) -(i+1)*sizeof(db->spawn[0]));
db->spawn[i].mapindex = map_id2index(mobspawn.m);
db->spawn[i].qty = mobspawn.num;
break;