aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2012-03-19 11:43:50 +0100
committerShauren <shauren.trinity@gmail.com>2012-03-19 11:43:50 +0100
commit90cacb9ab943c19bc6bfa919928a9a480bcb1b48 (patch)
treee5adddcbe22adc8d167ba21420e757a6d0a50c19
parenteff48a42d1af91bda4d534cfdf61e3fd1b0eb9a5 (diff)
Core/SmartScript: Fixed possible crashes when attempting to use StoreTargetList with a the same list already stored on the same id
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h
index faba3c05394..5fb691c87f2 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.h
+++ b/src/server/game/AI/SmartScripts/SmartScript.h
@@ -98,7 +98,13 @@ class SmartScript
return;
if (mTargetStorage->find(id) != mTargetStorage->end())
+ {
+ // check if already stored
+ if ((*mTargetStorage)[id] == targets)
+ return;
+
delete (*mTargetStorage)[id];
+ }
(*mTargetStorage)[id] = targets;
}