From 42a49cc0c957df9bed5c071705ca038213c05835 Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Sun, 5 May 2024 11:50:34 -0700 Subject: [PATCH] Add tests for invoked methods properly existing --- .../HediffComps/HediffComp_PregeneratedBabies.cs | 3 ++- .../RJW_Menstruation/RJW_Menstruation/PregnancyCommon.cs | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs index a5896db..a746615 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs @@ -16,7 +16,8 @@ namespace RJW_Menstruation // Unused, but can't hurt to track protected Dictionary enzygoticSiblings; - protected static readonly MethodInfo RandomLastName = typeof(PregnancyUtility).GetMethod("RandomLastName", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof(Pawn), typeof(Pawn), typeof(Pawn) }, null); + protected static readonly MethodInfo RandomLastName = typeof(PregnancyUtility).GetMethod("RandomLastName", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof(Pawn), typeof(Pawn), typeof(Pawn) }, null) + ?? throw new InvalidOperationException("PregnancyUtility.RandomLastName not found"); public bool HasBaby { diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/PregnancyCommon.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/PregnancyCommon.cs index 324ff39..c572dfc 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/PregnancyCommon.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/PregnancyCommon.cs @@ -11,8 +11,10 @@ namespace RJW_Menstruation { public static class PregnancyCommon { - private static readonly MethodInfo TryGetInheritedXenotype = typeof(PregnancyUtility).GetMethod("TryGetInheritedXenotype", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof(Pawn), typeof(Pawn), typeof(XenotypeDef).MakeByRefType() }, null); - private static readonly MethodInfo ShouldByHybrid = typeof(PregnancyUtility).GetMethod("ShouldByHybrid", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof(Pawn), typeof(Pawn) }, null); + private static readonly MethodInfo TryGetInheritedXenotype = typeof(PregnancyUtility).GetMethod("TryGetInheritedXenotype", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof(Pawn), typeof(Pawn), typeof(XenotypeDef).MakeByRefType() }, null) + ?? throw new InvalidOperationException("PregnancyUtility.TryGetInheritedXenotype not found"); + private static readonly MethodInfo ShouldByHybrid = typeof(PregnancyUtility).GetMethod("ShouldByHybrid", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof(Pawn), typeof(Pawn) }, null) + ?? throw new InvalidOperationException("PregnancyUtility.ShouldByHybrid not found"); public static string GetBabyInfo(IEnumerable babies) {