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

NRE caused by specific hardpointdatadef #188

Closed Hark0nnen closed 4 years ago

Hark0nnen commented 4 years ago

location with no real hardpoints but with blanks causes fatal index out of bounds error. idk if this is vanilla, ME or CU issue

at BattleTech.MechHardpointRules.GetWeaponPrefabName (BattleTech.HardpointDataDef hardpointDataDef, BattleTech.BaseComponentRef componentRef, System.String prefabBase, System.String location, System.Collections.Generic.List1[System.String]& usedPrefabNames) [0x0041a] in <4184af8dbeb44635831353f4d349631c>:0 at (wrapper dynamic-method) BattleTech.MechHardpointRules.GetComponentPrefabName_Patch3(BattleTech.HardpointDataDef,BattleTech.BaseComponentRef,string,string,System.Collections.Generic.List1&) at CustomUnits.MechDef_RefreshInventory.GetComponentPrefabName (BattleTech.ChassisDef chassis, BattleTech.BaseComponentRef componentRef, System.String prefabBase, System.String location, System.Collections.Generic.List`1[System.String]& usedPrefabNames) [0x00263] in

<15bd6971ee4a4a0aa9b69150be3e33b3>:0 at (wrapper dynamic-method) BattleTech.MechDef.RefreshInventory_Patch0(object) cause by this: { "location" : "centertorso", "weapons" : [ ], "blanks" : [ "chrPrfWeap_javelin_centertorso_blank_ah1" ], "mountingPoints" : [ ] },
CptMoore commented 4 years ago

me in ticket-3895:

ok dont think its ME, ME doesn't change vanilla values that could lead to NRE. additionally, the ME code itself suppresses vanilla code (GetComponentPrefabName) from actually calling the method (GetWeaponPrefabName) that crashes.. so not sure what happening there. Its like ME wasnt yet loaded and hasn't patched the game...

CptMoore commented 4 years ago

well one thing it could be... if ME hardpoint calculator coulnd't be setup, because the mech wasnt initialized the way ME requires it, then during the GetComponentPrefabName it falls back to vanilla and vanilla could of course throw NREs

CptMoore commented 4 years ago

Should be fixed by d6e528cd8ce77117fb57a7acf8397bc632b377ad

CptMoore commented 4 years ago

I reverted the fix, loading took too much performance away, mechs should be made vanilla compatible to avoid issues :(