summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-08-28 18:09:12 +0200
committerHaru <haru@dotalux.com>2013-08-28 18:09:12 +0200
commit1afeabfe1893f5dc6206658aad48544b2002e555 (patch)
tree54a765cb4e6b08452036cb99b1360f83579c39c7
parent184ad8a5c0c7930d73572156006a1ad069f86764 (diff)
downloadhercules-1afeabfe1893f5dc6206658aad48544b2002e555.tar.gz
hercules-1afeabfe1893f5dc6206658aad48544b2002e555.tar.bz2
hercules-1afeabfe1893f5dc6206658aad48544b2002e555.tar.xz
hercules-1afeabfe1893f5dc6206658aad48544b2002e555.zip
Fixed an error with the '+=' operator on string variables
When attempting to concatenate and assign to a previously empty string with +=, it'd throw a memory manager error. Follow-up to 22d2718. Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/map/script.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 05b7e6b57..6413b9a60 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3067,7 +3067,8 @@ void op_2(struct script_state *st, int op)
if (leftref.type != C_NOP)
{
- aFree(left->u.str);
+ if (left->type == C_STR) // don't free C_CONSTSTR
+ aFree(left->u.str);
*left = leftref;
}
}