Blecki / dwarfcorp

An open-source 3D colony management game for PC, Mac and Linux
http://www.dwarfcorp.com
Other
583 stars 72 forks source link

Null Reference while creating initial embarkment [fairly common] #1016

Open mklingen opened 5 years ago

mklingen commented 5 years ago

Looked at this, and what I'm seeing is that in CreateEntity<T> we're getting a crash, either while invoking the entity function, or checking to see if the entity function contains the object type, or while adding the entity to the root component.

So it could be any of those. I'm not sure how any of that could be true, but I'm putting in a check for the case where the entity library is not yet initialized. If that's true, maybe a mod messed up the entity library somehow?

https://sentry.io/organizations/cfg/issues/821633282/?project=192119&referrer=github_plugin

NullReferenceException: Object reference not set to an instance of an object.
  File "C:\Users\matth\Desktop\dwarfcorp\DwarfCorp\DwarfCorpXNA\Entities\EntityFactory.cs", line 106, in CreateEntity
    T CreateEntity[T](System.String, Microsoft.Xna.Framework.Vector3, DwarfCorp.Blackboard)
  File "C:\Users\matth\Desktop\dwarfcorp\DwarfCorp\DwarfCorpXNA\World\WorldManager-NewGameSetup.cs", line 54, in CreateInitialDwarves
    Void CreateInitialDwarves(Microsoft.Xna.Framework.Vector3)
  File "C:\Users\matth\Desktop\dwarfcorp\DwarfCorp\DwarfCorpXNA\World\WorldManager-NewGameSetup.cs", line 67, in CreateInitialEmbarkment
    Void CreateInitialEmbarkment()
  File "C:\Users\matth\Desktop\dwarfcorp\DwarfCorp\DwarfCorpXNA\World\WorldManager-Loading.cs", line 432, in LoadThreaded
    Void LoadThreaded()

Object reference not set to an instance of an object.
mklingen commented 5 years ago

Note that as of today I haven't seen my assert trigger, so it might not be that the entity library is uninitialized.