Core/Player: Prevent a crash in CastedCreatureOrGO and add an assertion to KilledMonster

This commit is contained in:
Nay committed 2013-01-04 21:15:18 +00:00
1 parent e5945402ad
commit 8ac5b3b7d6
5 files changed
+13 -5

No files matched your search

@@ -16007,6 +16007,8 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count)
void Player::KilledMonster(CreatureTemplate const* cInfo, uint64 guid)
{
ASSERT(cInfo);
if (cInfo->Entry)
KilledMonsterCredit(cInfo->Entry, guid);
@@ -16159,6 +16161,12 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id)
if (reqTarget != entry) // if entry doesn't match, check for killcredits referenced in template
{
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
if (!cinfo)
{
sLog->outError(LOG_FILTER_PLAYER, "Player::CastedCreatureOrGO: GetCreatureTemplate failed for entry %u. Skipping.", entry);
continue;
}
for (uint8 k = 0; k < MAX_KILL_CREDIT; ++k)
if (cinfo->KillCredit[k] == reqTarget)
entry = cinfo->KillCredit[k];