From efb03164c7559d4e9410144b06a2970957d245c3 Mon Sep 17 00:00:00 2001 From: Chris Miles Date: Sat, 7 Oct 2023 14:00:11 -0500 Subject: [PATCH] [Crash] Fix crash in CastSpell Quest API input cast (#3610) --- zone/lua_mob.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zone/lua_mob.cpp b/zone/lua_mob.cpp index 49dd21eee..8ceaef72f 100644 --- a/zone/lua_mob.cpp +++ b/zone/lua_mob.cpp @@ -878,7 +878,13 @@ bool Lua_Mob::CastSpell(int spell_id, int target_id) { bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot) { Lua_Safe_Call_Bool(); - return self->CastSpell(spell_id, target_id, static_cast(slot)); + + int cast_slot = 0; + if (slot >= 0 || slot <= 23 || slot == 255) { + cast_slot = slot; + } + + return self->CastSpell(spell_id, target_id, static_cast(cast_slot)); } bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time) {