Environment
- BaseLib: 3.4.0
- Slay the Spire 2: v0.110.0
- Platform: Windows / Steam
Reproduction
- Play as the Hunter.
- Play
BLADE_OF_INK.
- Obtain the enchanted
SHIV created by the card.
- Play that Shiv.
Actual behavior
The card resolution throws a NullReferenceException. The combat turn loop then
dies and the combat remains stuck until the room is restarted.
Relevant stack frame:
System.NullReferenceException
at BaseLib.Patches.Hooks.ModifyBaseDamagePatches.AdjustBaseUnenchanted(
Boolean runGlobalHooks,
Decimal num,
DynamicVar dynVar,
CardModel card)
Root cause
CardOwnerForVar(DynamicVar dynVar) returns CardModel?, but its result is
passed to AdjustBaseUnenchanted, whose first statement dereferences
card.Enchantment without checking whether card is null.
The analogous AdjustExtraUnenchanted method already accepts CardModel? and
handles this case.
Suggested fix
static decimal AdjustBaseUnenchanted(
bool runGlobalHooks,
decimal num,
DynamicVar dynVar,
CardModel? card)
{
if (card == null || card.Enchantment != null) return num;
// existing logic...
}
I tested the equivalent null guard as a local binary hotfix. BaseLib initialized
with 272 patches successfully, 0 failed, and the previously freezing
Blade of Ink 鈫?enchanted Shiv interaction completed normally.
Environment
Reproduction
BLADE_OF_INK.SHIVcreated by the card.Actual behavior
The card resolution throws a
NullReferenceException. The combat turn loop thendies and the combat remains stuck until the room is restarted.
Relevant stack frame:
Root cause
CardOwnerForVar(DynamicVar dynVar)returnsCardModel?, but its result ispassed to
AdjustBaseUnenchanted, whose first statement dereferencescard.Enchantmentwithout checking whethercardis null.The analogous
AdjustExtraUnenchantedmethod already acceptsCardModel?andhandles this case.
Suggested fix
I tested the equivalent null guard as a local binary hotfix. BaseLib initialized
with
272 patches successfully, 0 failed, and the previously freezingBlade of Ink 鈫?enchanted Shiv interaction completed normally.