Skip to content

Commit 02426e8

Browse files
authored
Merge pull request #4393 from CombatExtended-Continued/ammo_out_NRE_Fix
Fix NRE when magazineless weapon runs out of ammo
2 parents cf9c8c9 + 3c16dd8 commit 02426e8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Source/CombatExtended/CombatExtended/Comps/CompInventory.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,10 @@ public bool SwitchToNextViableWeapon(bool useFists = false, bool useAOE = false,
446446
}
447447
else if (useFists)
448448
{
449-
parentPawn.jobs.SuspendCurrentJob(JobCondition.InterruptForced);
449+
if (parentPawn.jobs.curJob != null) //check there is a current job before attempting to suspend it
450+
{
451+
parentPawn.jobs.SuspendCurrentJob(JobCondition.InterruptForced);
452+
}
450453
// Put away current weapon
451454
ThingWithComps eq = parentPawn.equipment?.Primary;
452455
if (eq != null && !parentPawn.equipment.TryTransferEquipmentToContainer(eq, container))

0 commit comments

Comments
 (0)