From 3db05a8dceea7b166d9e8d78281ea38badaa3cb6 Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Wed, 13 Sep 2023 16:55:01 +0200 Subject: [PATCH] Added some nullchecks for queen existance, fixing #60 --- CHANGELOG.md | 1 + Source/Genes/Hive/Helpers/HiveUtility.cs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 186c315..48efc2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - Copy of Infis patch for eating cum from sexperience, #41 and #48 - Updated some Icons to have better backgrounds (thanks @WasmachenDennSachenSo #53) - Custom Queen- and Drone-Xenotypes should work now. +- Some more checks if Queen is on Map or not (fixing #60) *Notes*: The pawns that are gender fluid can get pregnant. diff --git a/Source/Genes/Hive/Helpers/HiveUtility.cs b/Source/Genes/Hive/Helpers/HiveUtility.cs index 03bdf34..089be9c 100644 --- a/Source/Genes/Hive/Helpers/HiveUtility.cs +++ b/Source/Genes/Hive/Helpers/HiveUtility.cs @@ -61,6 +61,9 @@ namespace RJW_Genes /// True if the pawn is on the home-map, False otherwise. public static bool PawnIsOnHomeMap(Pawn pawn) { + if (Find.Maps.NullOrEmpty() || !Find.Maps.Where(mapCandidate => mapCandidate.IsPlayerHome).Any()) { + return false; + } Map homeMap = Find.Maps.Where(mapCandidate => mapCandidate.IsPlayerHome).First(); return homeMap != null && pawn != null