diff --git a/EOLib/PacketHandlers/SpellTrainingHandler.cs b/EOLib/PacketHandlers/SpellTrainingHandler.cs index ceef26d23..8a022d8ea 100644 --- a/EOLib/PacketHandlers/SpellTrainingHandler.cs +++ b/EOLib/PacketHandlers/SpellTrainingHandler.cs @@ -31,8 +31,11 @@ public override bool HandlePacket(IPacket packet) var spellId = packet.ReadShort(); var spellLevel = packet.ReadShort(); - _characterInventoryRepository.SpellInventory.RemoveWhere(x => x.ID == spellId); - _characterInventoryRepository.SpellInventory.Add(new InventorySpell(spellId, spellLevel)); + if (spellId > 0) + { + _characterInventoryRepository.SpellInventory.RemoveWhere(x => x.ID == spellId); + _characterInventoryRepository.SpellInventory.Add(new InventorySpell(spellId, spellLevel)); + } var stats = _characterRepository.MainCharacter.Stats.WithNewStat(CharacterStat.SkillPoints, skillPoints); _characterRepository.MainCharacter = _characterRepository.MainCharacter.WithStats(stats);