RimWorld

RimWorld

Faction Blender Continued (1.6)
NullReference in GenerateScarabs_Override when generating ancient caskets
When generating ancient cryptosleep caskets, Faction Blender’s GenerateScarabs_Override throws a NullReferenceException if the PawnKindDef list is empty or contains nulls. This happens during map generation, in ThingSetMaker_MapGen_AncientPodContents.
Likely cause: another mod (e.g. RimWar, Progression Agriculture) alters the pawn list or missing pawn defs in the mod list.

Log excerpt:

System.NullReferenceException: Object reference not set to an instance of an object
at FactionBlender.HarmonyPatches+GenerateAncientsPatches.GenerateScarabs_Override(...)

Suggested fix:
Add null checks before processing pawnkind list and ensure it’s not empty before calling .RandomElement().