Skip to content

Error when equipping shield if one is already equipped. #28

@SickBoyWi

Description

@SickBoyWi

If I have a pawn with a shield equipped, and try to equip a different one, I get this error:

JobDriver threw exception in initAction for pawn Rogrum driver=JobDriver_Equip (toilIndex=1) driver.job=(Equip (Job_87) A=Thing_RH_TET_Dwarf_ShieldMid58557) lastJobGiver=Verse.AI.ThinkNode_QueuedJob
System.NullReferenceException: Object reference not set to an instance of an object
at PawnShields.HarmonyPatches.EquipmentTracker_GetPawn (object) <0x0001e>
at PawnShields.HarmonyPatches.Patch_Pawn_EquipmentTracker_MakeRoomFor (Verse.Pawn_EquipmentTracker,Verse.ThingWithComps&) <0x00092>
at (wrapper dynamic-method) Verse.Pawn_EquipmentTracker.MakeRoomFor_Patch1 (object,Verse.ThingWithComps) <0x00152>
at Verse.AI.JobDriver_Equip/c__Iterator0.<>m__0 () <0x000f9>
at Verse.AI.JobDriver.TryActuallyStartNextToil () <0x0071f>

Verse.Log:Error(String, Boolean)
Verse.AI.JobUtility:TryStartErrorRecoverJob(Pawn, String, Exception, JobDriver)
Verse.AI.JobDriver:TryActuallyStartNextToil()
Verse.AI.JobDriver:ReadyForNextToil()
Verse.AI.JobDriver:Notify_PatherArrived()
Verse.AI.Pawn_PathFollower:PatherArrived()
Verse.AI.Pawn_PathFollower:TryEnterNextPathCell()
Verse.AI.Pawn_PathFollower:PatherTick()
Verse.Pawn:Tick_Patch1(Object)
Verse.TickList:Tick()
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:UpdatePlay()
Verse.Root_Play:Update()

I traced it back through your source code, and here's the function that fails. The only thing that can be null there seems to be 'pawnField_Pawn_EquipmentTracker'.

        public static Pawn EquipmentTracker_GetPawn(object instance)
        {
            return (Pawn)pawnField_Pawn_EquipmentTracker.GetValue(instance);
        }

Is this a known issue? I don't see an open issue for it. Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions