From 20314730adbd4181b405df382c50666be6a15d54 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Wed, 28 Mar 2018 22:05:25 +0200 Subject: [PATCH] Core/SAI: fixed a crash --- src/server/game/AI/SmartScripts/SmartScript.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 069414b095..5853c8914e 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1446,7 +1446,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u e.GetTargetType() == SMART_TARGET_SELF || e.GetTargetType() == SMART_TARGET_STORED)*/ { // we want to move to random element - target = Trinity::Containers::SelectRandomContainerElement(targets); + if (!targets.empty()) + target = Trinity::Containers::SelectRandomContainerElement(targets); } if (!target)