Some input sanitization for the egg life span and ovulation genes

This commit is contained in:
lutepickle 2024-02-08 20:44:58 -08:00
parent fcbc19825e
commit 02b0045fb3

View file

@ -681,7 +681,6 @@ namespace RJW_Menstruation
opcache = -1; 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<MenstruationModExtension>())) foreach (MenstruationModExtension extension in Pawn.genes.GenesListForReading.Select(gene => gene.def.GetModExtension<MenstruationModExtension>()))
{ {
if (extension == null) continue; if (extension == null) continue;
@ -692,6 +691,8 @@ namespace RJW_Menstruation
ovulationFactor *= extension.ovulationFactor; ovulationFactor *= extension.ovulationFactor;
if (extension.noBleeding) noBleeding = true; if (extension.noBleeding) noBleeding = true;
} }
if (eggLifeSpanTicks < 0) eggLifeSpanTicks = 0;
if (ovulationFactor < 0f) ovulationFactor = 0f;
} }
public bool ShouldSimulate() public bool ShouldSimulate()