From ded844c0b7141ae18d6fc9e38687dd846af749d2 Mon Sep 17 00:00:00 2001 From: jbo3320 <106225342+jbo3320@users.noreply.github.com> Date: Fri, 24 Jul 2026 03:21:43 +0900 Subject: [PATCH] Guard HuntManager.OnBotCreated against null SpawnProfileData/Id_spawn OnBotCreated runs for every created bot and dereferenced bot.SpawnProfileData.SpawnParams.Id_spawn.ToLower() with no null check. Bots spawned outside the normal EFT flow (e.g. MiyakoCarryService's carry bot via SpawnMcsBotPlayer) can have a null SpawnProfileData/Id_spawn, throwing an NRE. Because the handler runs inside BotSpawner.OnBotCreated, the throw propagates up and aborts the other mod's spawn. A null Id_spawn is not a "hunt" spawn, so guarding and early-returning is the correct behavior. Fixes #5. Co-Authored-By: Claude Opus 4.8 --- Plugin/Components/HuntManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Plugin/Components/HuntManager.cs b/Plugin/Components/HuntManager.cs index 471377f..2456c79 100644 --- a/Plugin/Components/HuntManager.cs +++ b/Plugin/Components/HuntManager.cs @@ -36,7 +36,9 @@ public void InitRaid() public void OnBotCreated(BotOwner bot) { - if (!bot.SpawnProfileData.SpawnParams.Id_spawn.ToLower().Contains("hunt")) return; + // Bots spawned outside the normal EFT flow (e.g. other mods' custom bots) can have a + // null SpawnProfileData/Id_spawn; guard so this handler can't abort their spawn. + if (bot?.SpawnProfileData?.SpawnParams?.Id_spawn?.ToLower().Contains("hunt") != true) return; var huntManager = bot.gameObject.GetOrAddComponent();