Repository navigation
Resource tree: don't crash on a model with no IMC handle - #611
Merged
Ottermandias merged 1 commit intoNov 12, 2026
Merged
Conversation
A weapon summoned on a body the game doesn't ship has a null IMC handle, so ResolveImcData threw a NullReferenceException and every resource tree call for that character failed. Return the default entry for it, as for an IMC handle with no data. Co-Authored-By: Claude Opus 5.5 <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.
While working on a custom plugin that can turn entities into props with custom IDs for animations, I ran into the following issue with Penumbra:
When a character has a weapon summoned on a body number the game doesn’t ship (for example a mod’s prop placed on a free body), that model has no IMC file, so its IMC handle is null. ResolveContext.ResolveImcData reads the handle’s data without checking it, so building the resource tree throws a NullReferenceException in ResourceHandle.GetDataSpan(). While that model is drawn, every resource tree call for the character fails, so PlayerSync and LightlessSync can’t build the player’s data.
The fix returns the default IMC entry for a null handle. That’s what ResolveImcData already does for a handle with no data, and CreateNodeFromImc already skips a null handle.
Tested in game on 1.7.2.1 with the fix applied: with such a prop out, GetGameObjectResourcePaths no longer throws and lists the prop’s files, and both sync plugins build the player’s data again.