From 4e872dcc6c4a357a3058f03e64ca91f649c05bed Mon Sep 17 00:00:00 2001 From: Vld Mrk Date: Mon, 4 Nov 2024 11:13:33 +0100 Subject: [PATCH] Add null check for monster in ArchMageMatsArmy and log warning if not found --- Army/Various/ArmyArchMageBossItems.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Army/Various/ArmyArchMageBossItems.cs b/Army/Various/ArmyArchMageBossItems.cs index fcae9d60d..fa0c4e30a 100644 --- a/Army/Various/ArmyArchMageBossItems.cs +++ b/Army/Various/ArmyArchMageBossItems.cs @@ -92,7 +92,13 @@ public void ArmyKillMonster(string map, string cell, int MonID, string item, int Core.Join(map); Army.waitForPartyCell(cell, playerCount: Army.Players().Count()); - Monster mon = Bot.Monsters.MapMonsters.FirstOrDefault(x => x != null && x.ID == MonID); + Monster? mon = Bot.Monsters.MapMonsters.FirstOrDefault(x => x != null && x.ID == MonID); + + if (mon == null) + { + Core.Logger($"Monster {MonID} not found."); + return; + } if (!isTemp) Core.AddDrop(item);