From 02b0045fb35573f9901b669c21f7a77e9b89ba18 Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Thu, 8 Feb 2024 20:44:58 -0800 Subject: [PATCH] Some input sanitization for the egg life span and ovulation genes --- .../RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index ff03dea..f970ff8 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -680,8 +680,7 @@ namespace RJW_Menstruation noBleeding = false; opcache = -1; - if (Pawn.genes == null || !ModsConfig.BiotechActive) return; - + if (Pawn.genes == null || !ModsConfig.BiotechActive) return; foreach (MenstruationModExtension extension in Pawn.genes.GenesListForReading.Select(gene => gene.def.GetModExtension())) { if (extension == null) continue; @@ -692,6 +691,8 @@ namespace RJW_Menstruation ovulationFactor *= extension.ovulationFactor; if (extension.noBleeding) noBleeding = true; } + if (eggLifeSpanTicks < 0) eggLifeSpanTicks = 0; + if (ovulationFactor < 0f) ovulationFactor = 0f; } public bool ShouldSimulate()