From 0e9c696de609371402f356e191a38333a0dbb61e Mon Sep 17 00:00:00 2001
From: Image <image.emagi@gmail.com>
Date: Thu, 8 Apr 2021 08:20:45 -0400
Subject: [PATCH] spell crash fix when spell can't be found (happened on drink
 but we dont know what spell)

---
 EQ2/source/WorldServer/WorldDatabase.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/EQ2/source/WorldServer/WorldDatabase.cpp b/EQ2/source/WorldServer/WorldDatabase.cpp
index a9aaf43f3..e08591c57 100644
--- a/EQ2/source/WorldServer/WorldDatabase.cpp
+++ b/EQ2/source/WorldServer/WorldDatabase.cpp
@@ -7416,6 +7416,16 @@ void WorldDatabase::LoadCharacterSpellEffects(int32 char_id, Client* client, int
 
 		Spell* spell = master_spell_list.GetSpell(spell_id, tier);
 		
+		if(!spell)
+		{
+			LogWrite(LUA__ERROR, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: GetSpell(%u, %u), spell could not be found!", spell_id, tier);
+			Spell* spell = master_spell_list.GetSpell(spell_id, 0);
+			if(spell)
+				LogWrite(LUA__WARNING, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: GetSpell(%u, %u), identified tier 0 as replacement since the GetSpell failed!", spell_id, tier);
+			else
+				continue;
+		}
+		
 		bool isMaintained = false;
 		bool isExistingLuaSpell = false;
 		MaintainedEffects* effect = nullptr;