From 0f3f282e9a73f6bba47bc6d320e9b08f733e6ee8 Mon Sep 17 00:00:00 2001 From: Lynx3d Date: Fri, 1 Apr 2011 10:07:07 +0200 Subject: [PATCH] [11303] Fix crash in HandleTrainerBuySpellOpcode Signed-off-by: NoFantasy --- src/game/NPCHandler.cpp | 7 +++++-- src/shared/revision_nr.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index d6d95718b..9e0eaeae5 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -248,11 +248,14 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data ) if (!cSpells && !tSpells) return; - // not found, cheat? - TrainerSpell const* trainer_spell = cSpells->Find(spellId); + // Try find spell in npc_trainer + TrainerSpell const* trainer_spell = cSpells ? cSpells->Find(spellId) : NULL; + + // Not found, try find in npc_trainer_template if (!trainer_spell && tSpells) trainer_spell = tSpells->Find(spellId); + // Not found anywhere, cheating? if (!trainer_spell) return; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 45929075f..d75d13a1d 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11302" + #define REVISION_NR "11303" #endif // __REVISION_NR_H__