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
1 changed files with 3 additions and 2 deletions

View File

@ -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<MenstruationModExtension>()))
{
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()