JonnyOThan / TweakScale

Forked from Gaius Goodspeed's Goodspeed Aerospace Part & TweakScale plugin
Other
3 stars 2 forks source link

Report: fatal NRE in TweakScale.IModuleInfo.GetInfo #55

Closed JonnyOThan closed 5 months ago

JonnyOThan commented 5 months ago

https://forum.kerbalspaceprogram.com/topic/222953-1125-wip-tweakscale-rescaled/?do=findComment&comment=4364456

I have an issue with this mod and upon starting KSP, it informs that it cannot continue loading the game. https://drive.google.com/file/d/1_TdYz4ZZOcIil1mVr4pk_jXhsJ0N_9Q4/view?usp=drive_link Loading has failed due to an unhandled error Failure in subsystem : Part compilation Part: MechJeb 2 (AR202 case) (MechJeb2/Parts/MechJeb2_AR202/part/mumech_MJ2_AR202)

System.NullReferenceException: Object reference not set to an instance of an object
  at TweakScale.TweakScale.IModuleInfo.GetInfo () [0x0000b] in <6faecc74fdad4e4ba4e9a090ec4483f3>:0
  at PartLoader.CompilePartInfo (AvailablePart newPartInfo, Part part) [0x0017c] in <4b449f2841f84227adfaad3149c8fdba>:0
  at (wrapper dynamic-method) PartLoader+<CompileParts>d__56.PartLoader+<CompileParts>d__56.MoveNext_Patch0(PartLoader/<CompileParts>d__56)
  at KSPCommunityFixes.Performance.KSPCFFastLoader+<FrameUnlockedCoroutine>d__62.MoveNext () [0x0006c] in <3eabfe001b54477fa1107e2a2ab315ee>:0

The log file is restricted, so I'm not sure how much I can do with this until I get the full thing. But since exceptions in this function will be fatal to loading, I'd better make sure it's bulletproof even if that's a catch 'em all.

JonnyOThan commented 5 months ago
65289 [ERR 17:25:50.204] Module TweakScale threw during OnLoad: System.ArgumentException: An item with the same key has already been added. Key: TweakScale
65290   at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x000c1] in <9577ac7a62ef43179789031239ba8798>:0 
65291   at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <9577ac7a62ef43179789031239ba8798>:0 
65292   at System.Linq.Enumerable.ToDictionary[TSource,TKey] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x00085] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
65293   at System.Linq.Enumerable.ToDictionary[TSource,TKey] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector) [0x00000] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
65294   at TweakScale.ScaleExponents.CreateExponentsForModule (ConfigNode node, System.Collections.Generic.Dictionary`2[TKey,TValue] parent) [0x00040] in <6faecc74fdad4e4ba4e9a090ec4483f3>:0 
65295   at TweakScale.ScaleType..ctor (ConfigNode scaleConfig) [0x00202] in <6faecc74fdad4e4ba4e9a090ec4483f3>:0 
65296   at TweakScale.TweakScale.OnLoad (ConfigNode node) [0x0001a] in <6faecc74fdad4e4ba4e9a090ec4483f3>:0 
65297   at PartModule.Load (ConfigNode node) [0x001ab] in <4b449f2841f84227adfaad3149c8fdba>:0