I finally fixed this issue, and I'm posting the issue here for any one else that encounters it.
RawCode is on the right track here.
I was doing this:
The correct thing to do is this:
If that first call to the listerThings.ThingsOfdef finds nothing, it returns null. That causes all kinds of chaos, and the next call doesn't throw a NPE, it throws the weird error I mentioned above. This was very tough to track, and find. Almost impossible I'd say, as the actual error gets squashed.
I encountered this same error while working on a different mod, and was actually able to pin it down. With that info, I fixed my original error from way back when.
Hopefully this can be of help to someone at some point!
RawCode is on the right track here.
I was doing this:
Code Select
List<Thing> thrones = maps[index].listerThings.ThingsOfDef(RH_TET_DwarfDefOf.RH_TET_Dwarfs_Throne);
thrones.AddRange(maps[index].listerThings.ThingsOfDef(RH_TET_DwarfDefOf.RH_TET_Dwarfs_KingsThrone));
The correct thing to do is this:
Code Select
List<Thing> thrones = new List<Thing>();
thrones.AddRange(maps[index].listerThings.ThingsOfDef(RH_TET_DwarfDefOf.RH_TET_Dwarfs_Throne));
thrones.AddRange(maps[index].listerThings.ThingsOfDef(RH_TET_DwarfDefOf.RH_TET_Dwarfs_KingsThrone));
If that first call to the listerThings.ThingsOfdef finds nothing, it returns null. That causes all kinds of chaos, and the next call doesn't throw a NPE, it throws the weird error I mentioned above. This was very tough to track, and find. Almost impossible I'd say, as the actual error gets squashed.
I encountered this same error while working on a different mod, and was actually able to pin it down. With that info, I fixed my original error from way back when.
Hopefully this can be of help to someone at some point!