Skip to content

Commit

Permalink
Added more null checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
RealityMachina committed May 23, 2018
1 parent fee06d3 commit c06b02f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion PunchinOut/BasicPanic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ public static void Prefix(AttackStackSequence __instance, MessageCenterMessage m

if (__instance.directorSequences[0].target is Mech)
{
ShouldPanic = RollHelpers.ShouldPanic(__instance.directorSequences[0].target as Mech, attackCompleteMessage.attackSequence);
mech = __instance.directorSequences[0].target as Mech;
ShouldPanic = RollHelpers.ShouldPanic(mech, attackCompleteMessage.attackSequence);


}

Expand Down Expand Up @@ -194,6 +195,11 @@ public static int GetTrackedPilotIndex(Mech mech)
return -1;
}

if(Holder.TrackedPilots == null)
{
Holder.TrackedPilots = new List<PanicTracker>();
}

for (int i = 0; i < Holder.TrackedPilots.Count; i++)
{

Expand All @@ -217,6 +223,11 @@ public static bool ShouldPanic(Mech mech, AttackDirector.AttackSequence attackSe
return false;
}

if(attackSequence == null)
{
return false;
}

if (!attackSequence.attackDidDamage) //no point in panicking over nothing
{
return false;
Expand Down

0 comments on commit c06b02f

Please sign in to comment.