From f11d1767c108abeab2731437d28ad77f6db8658e Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Mon, 15 Sep 2014 09:48:30 +0300 Subject: [PATCH] Remove crash on mangos from not unloaded objects on unload --- ElunaEventMgr.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ElunaEventMgr.cpp b/ElunaEventMgr.cpp index e82cf63..2dd4b06 100644 --- a/ElunaEventMgr.cpp +++ b/ElunaEventMgr.cpp @@ -51,9 +51,11 @@ ElunaEventProcessor::~ElunaEventProcessor() RemoveEvents(); // In multithread get the object's map's lua state - Eluna* E = obj ? sEluna : sEluna; - EventMgr::WriteGuard lock(E->eventMgr->GetLock()); - E->eventMgr->processors.erase(this); + if (Eluna* E = obj ? sEluna : sEluna) + { + EventMgr::WriteGuard lock(E->eventMgr->GetLock()); + E->eventMgr->processors.erase(this); + } } void ElunaEventProcessor::Update(uint32 diff)