edbmods / EdBPrepareCarefully

EdB Prepare Carefully, a RimWorld mod
MIT License
232 stars 91 forks source link

Error while generating map with custom ScenParts #294

Closed dninemfive closed 6 months ago

dninemfive commented 4 years ago

I'm working on a mod which adds new ScenParts and Prepare Carefully causes an error when creating a new world when the current scenario uses them. Specifically, it errors with my Scenpart_factionRelations:

Exception from asynchronous event: System.NullReferenceException: Object reference not set to an instance of an object
  at ChickenScenParts.ScenPart_FactionRelations.PostGameStart () [0x00014] in <b64e403c0d6f40fb90a72841b4f4b837>:0 
  at RimWorld.Scenario.PostGameStart () [0x00014] in <65f126dfb1e4464fa378d4b237f11a99>:0 
  at (wrapper dynamic-method) Verse.Game.DMD<DMD<InitNewGame_Patch1>?-1591050368::InitNewGame_Patch1>(Verse.Game)
  at Verse.Root_Play+<>c.<Start>b__1_2 () [0x00011] in <65f126dfb1e4464fa378d4b237f11a99>:0 
  at Verse.LongEventHandler.RunEventFromAnotherThread (System.Action action) [0x00008] in <65f126dfb1e4464fa378d4b237f11a99>:0 
Verse.Log:Error(String, Boolean)
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.<>c:<UpdateCurrentAsynchronousEvent>b__27_0()
System.Threading.ThreadHelper:ThreadStart_Context(Object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object)
System.Threading.ThreadHelper:ThreadStart()

My load order was:

Harmony
Core
Royalty
[RH] Faction: Coalition // the mod Chicken Plucker is working on, using my code
EdB Prepare Carefully

I'm fairly certain this is on your end because I added extensive null-checking on mine. The stack trace indicates it comes from your patch of Game.InitGame(), though I admit I haven't been able to understand what, exactly, this patch does.

Obviously, it's possible I'm mistaken and I'm causing this error, but I don't see how. If you do, please don't hesitate to point out my mistake.

edbmods commented 6 months ago

Going through and closing old issues that are probably no longer relevant.