Core/Calendar: Fix crash when deleting an event on the calendar. Should also stop the error message from appearing.
Thanks elecyb
Closes #6570
- Corrected some code from 66d42b4f29
This commit is contained in:
@@ -95,9 +95,9 @@ CalendarEventIdList const& CalendarMgr::GetPlayerEvents(uint64 guid)
|
|||||||
|
|
||||||
CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId)
|
CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId)
|
||||||
{
|
{
|
||||||
CalendarInviteMap::iterator it = _invites.find(inviteId);
|
CalendarInviteMap::iterator itr = _invites.find(inviteId);
|
||||||
if (it != _invites.end())
|
if (itr != _invites.end())
|
||||||
return &(it->second);
|
return &(itr->second);
|
||||||
|
|
||||||
sLog->outError("CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId);
|
sLog->outError("CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -105,9 +105,9 @@ CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId)
|
|||||||
|
|
||||||
CalendarEvent* CalendarMgr::GetEvent(uint64 eventId)
|
CalendarEvent* CalendarMgr::GetEvent(uint64 eventId)
|
||||||
{
|
{
|
||||||
CalendarEventMap::iterator it = _events.find(eventId);
|
CalendarEventMap::iterator itr = _events.find(eventId);
|
||||||
if (it != _events.end())
|
if (itr != _events.end())
|
||||||
return &(it->second);
|
return &(itr->second);
|
||||||
|
|
||||||
sLog->outError("CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId);
|
sLog->outError("CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -316,11 +316,6 @@ void CalendarMgr::AddAction(CalendarAction const& action)
|
|||||||
if (!calendarEvent)
|
if (!calendarEvent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CalendarInviteIdList const& inviteIds = calendarEvent->GetInviteIdList();
|
|
||||||
for (CalendarInviteIdList::const_iterator it = inviteIds.begin(); it != inviteIds.end(); ++it)
|
|
||||||
if (uint64 invitee = RemoveInvite(*it))
|
|
||||||
SendCalendarEventRemovedAlert(invitee, *calendarEvent);
|
|
||||||
|
|
||||||
RemoveEvent(eventId);
|
RemoveEvent(eventId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -464,8 +459,6 @@ bool CalendarMgr::RemoveEvent(uint64 eventId)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_events.erase(itr);
|
|
||||||
|
|
||||||
bool val = true;
|
bool val = true;
|
||||||
|
|
||||||
CalendarInviteIdList const& invites = itr->second.GetInviteIdList();
|
CalendarInviteIdList const& invites = itr->second.GetInviteIdList();
|
||||||
@@ -474,8 +467,13 @@ bool CalendarMgr::RemoveEvent(uint64 eventId)
|
|||||||
CalendarInvite* invite = GetInvite(*itrInvites);
|
CalendarInvite* invite = GetInvite(*itrInvites);
|
||||||
if (!invite || !RemovePlayerEvent(invite->GetInvitee(), eventId))
|
if (!invite || !RemovePlayerEvent(invite->GetInvitee(), eventId))
|
||||||
val = false;
|
val = false;
|
||||||
|
|
||||||
|
if (uint64 invitee = RemoveInvite(*itrInvites))
|
||||||
|
SendCalendarEventRemovedAlert(invitee, itr->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_events.erase(itr);
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1733,8 +1733,8 @@ void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recvPacket)
|
|||||||
recvPacket >> moveStop;
|
recvPacket >> moveStop;
|
||||||
|
|
||||||
Unit* caster = ObjectAccessor::GetUnit(*_player, guid);
|
Unit* caster = ObjectAccessor::GetUnit(*_player, guid);
|
||||||
Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : NULL;
|
Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_GENERIC_SPELL) : NULL;
|
||||||
if (!spell || spell->m_spellInfo->Id != spellId || !spell->m_targets.HasDst())
|
if (!spell || spell->m_spellInfo->Id != spellId || !spell->m_targets.HasDst() || !spell->m_targets.HasSrc())
|
||||||
{
|
{
|
||||||
recvPacket.rfinish();
|
recvPacket.rfinish();
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user