BattletechModders / MechEngineer

Mod for BattleTech that introduces many CBT mechanics to the MechLab
GNU Lesser General Public License v2.1
11 stars 21 forks source link

AttackSequence might be null and throwing exceptions #197

Closed CptMoore closed 3 years ago

CptMoore commented 3 years ago

Most vanilla methods check if attackSequence is null, except for case handling head stats

in ApplyHeadStructureEffects

attackSequence = base.Combat.AttackDirector.GetAttackSequence(hitInfo.attackSequenceId);

Stacktrace

2020-10-31T03:36:16 FYLS [ERROR] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation at (wrapper dynamic-method) BattleTech.Mech.ApplyHeadStructureEffects_Patch1(object,BattleTech.ChassisLocations,BattleTech.LocationD at (wrapper dynamic-method) BattleTech.Mech.ApplyStructureStatDamage_Patch1(object,BattleTech.ChassisLocations,single,BattleTech.Wea at MechEngineer.Features.ComponentExplosions.Patches.Mech_DamageLocation_Patch.ApplyStructureStatDamage (BattleTech.Mech mech, Battl at (wrapper dynamic-method) BattleTech.Mech.DamageLocation_Patch6(object,int,BattleTech.WeaponHitInfo,BattleTech.ArmorLocation,Battl at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Excep at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binde --- End of inner exception stack trace --- at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binde at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <d7ac571ca2d04b2f981d0d886fa067c at Harmony.Traverse.GetValue () [0x00078] in <1b23547042994e96b8b6361dbe3791d9>:0 at Harmony.Traverse.GetValue[T] () [0x00001] in <1b23547042994e96b8b6361dbe3791d9>:0 at MechEngineer.Features.ComponentExplosions.MechPrivateExtensions.DamageLocation (BattleTech.Mech mech, System.Int32 originalHitLoc at MechEngineer.Features.ComponentExplosions.ComponentExplosionsFeature.CheckForExplosion (BattleTech.MechComponent component, Battl at MechEngineer.Features.ComponentExplosions.Patches.MechComponent_DamageComponent_Patch.Postfix (BattleTech.MechComponent __instanc

see https://discord.com/channels/565106671693856778/772052215270473759/772068678820298752