[Crash] Validate item in SE_SummonItemIntoBag (#4734)

This commit is contained in:
Chris Miles 2025-03-01 18:32:43 -06:00 committed by GitHub
parent ab14458f9e
commit 0ef79903f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1243,6 +1243,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
case SE_SummonItemIntoBag: case SE_SummonItemIntoBag:
{ {
const EQ::ItemData *item = database.GetItem(spell.base_value[i]); const EQ::ItemData *item = database.GetItem(spell.base_value[i]);
if (!item) {
Message(Chat::Red, "Unable to summon item %d. Item not found.", spell.base_value[i]);
break;
}
#ifdef SPELL_EFFECT_SPAM #ifdef SPELL_EFFECT_SPAM
const char *itemname = item ? item->Name : "*Unknown Item*"; const char *itemname = item ? item->Name : "*Unknown Item*";
snprintf(effect_desc, _EDLEN, "Summon Item In Bag: %s (id %d)", itemname, spell.base_value[i]); snprintf(effect_desc, _EDLEN, "Summon Item In Bag: %s (id %d)", itemname, spell.base_value[i]);