Resolved Unarmed combat results in null reference exception.

Users who are viewing this thread

Version number
1.5.3
Branch
Main
Modded/unmodded
Yes, I used mods.

Peanut_Brother

Sergeant
I'm writing a mod that involves a fist fight in a bar (I'm using Mission.StartCustomFight() and passing dropWeapons=true as an arg).

After a few seconds into testing the fight, it crashes with a System.NullReferenceException.

After doing some debugging, it looks like there might need to be an additional null check in the following method:
namespace: Sandbox
Class: SandboxAgentApplyDamageModel
Method: DecideCrushedThrough
line 307
C#:
if (defendItem.IsShield)
            {
                num *= 1.2f;
            }

Upon the crash, defendItem's value is null. I can provide more information if needed.


Thanks!
 
Back
Top Bottom