Guard HuntManager.OnBotCreated against null SpawnProfileData/Id_spawn - #6
Open
jbo3320 wants to merge 1 commit into
Open
Guard HuntManager.OnBotCreated against null SpawnProfileData/Id_spawn#6jbo3320 wants to merge 1 commit into
jbo3320 wants to merge 1 commit into
Conversation
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 TacticalToaster#5. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5.
HuntManager.OnBotCreatedruns for every created bot and dereferencesbot.SpawnProfileData.SpawnParams.Id_spawn.ToLower()with no null check. Bots spawned outside the normal EFT flow — e.g. MiyakoCarryService's carry bot viaSpawnMcsBotPlayer— can have a nullSpawnProfileData/Id_spawn, so this throws aNullReferenceException(observed at offset0x0000c). Because the handler runs insideBotSpawner.OnBotCreated, the throw propagates up and aborts the other mod's spawn — that mod's bot intermittently fails to appear.This adds a null-conditional guard. A null
Id_spawnis by definition not a"hunt"spawn, so early-returning is the correct behavior — no functional change for real hunt bots.Before
After
Full repro and stack trace are in #5. Cross-reported downstream at himesamanoyume/MiyakoCarryService#10.