Added some nullchecks for queen existance, fixing #60

This commit is contained in:
Vegapnk 2023-09-13 16:55:01 +02:00
parent 70a15dbfed
commit 3db05a8dce
2 changed files with 4 additions and 0 deletions

View file

@ -61,6 +61,9 @@ namespace RJW_Genes
/// <returns>True if the pawn is on the home-map, False otherwise.</returns>
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