diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll index 93bb6cb..9933165 100644 Binary files a/1.4/Assemblies/RJW_Menstruation.dll and b/1.4/Assemblies/RJW_Menstruation.dll differ diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs index 1d5eb60..71e930c 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs @@ -356,7 +356,7 @@ namespace RJW_Menstruation { baseAreola = Mathf.Clamp01(baseAreola + amount); UpdateNipples(); - } + } public void UpdateNipples() { @@ -365,7 +365,7 @@ namespace RJW_Menstruation cachedNipple = baseNipple + nippleProgress * nippleChange; // For some reason, Props can go null when RJW relocates the chest (e.g. some animals), so catch that - cachedColor = Colors.CMYKLerp(Pawn.story?.SkinColor ?? Color.white, (Props?.BlackNippleColor ?? CompProperties_Breast.DefaultBlacknippleColor.ToColor), Alpha); + cachedColor = Colors.CMYKLerp(Utility.SafeSkinColor(Pawn), (Props?.BlackNippleColor ?? CompProperties_Breast.DefaultBlacknippleColor.ToColor), Alpha); } public void CopyBreastProperties(HediffComp_Breast original) diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs index 82b3ced..4d428a9 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs @@ -394,7 +394,7 @@ namespace RJW_Menstruation anal = pawn.GetAnalIcon(showOrigin); GUI.color = new Color(1.00f, 0.47f, 0.47f, 1); GUI.Box(rect, "", boxstyle); - GUI.color = pawn.story.SkinColor; + GUI.color = Utility.SafeSkinColor(pawn); //Widgets.DrawTextureFitted(genitalIconRect, anal, 1.0f); //Widgets.DrawTextureFitted(genitalIconRect, vagina, 1.0f); GUI.DrawTexture(genitalIconRect, anal, ScaleMode.ScaleToFit); diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs index 29ffb97..406a54c 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs @@ -209,7 +209,7 @@ namespace RJW_Menstruation nipple = ContentFinder.Get("Breasts/Breast_Breast00_Nipple00", false); areola = ContentFinder.Get("Breasts/Breast_Breast00_Areola00", false); - GUI.color = pawn.story?.SkinColor ?? Color.white; + GUI.color = SafeSkinColor(pawn); GUI.DrawTexture(rect, breast, ScaleMode.ScaleToFit); GUI.color = Color.white; GUI.DrawTexture(rect, areola, ScaleMode.ScaleToFit); @@ -236,7 +236,7 @@ namespace RJW_Menstruation breast = ContentFinder.Get(icon, false); areola = ContentFinder.Get(areolaicon, false); nipple = ContentFinder.Get(nippleicon, false); - GUI.color = pawn.story.SkinColor; + GUI.color = SafeSkinColor(pawn); GUI.DrawTexture(rect, breast, ScaleMode.ScaleToFit); GUI.color = comp.NippleColor; @@ -255,7 +255,7 @@ namespace RJW_Menstruation nipple = ContentFinder.Get("Breasts/Breast_Breast00_Nipple00", false); areola = ContentFinder.Get("Breasts/Breast_Breast00_Areola00", false); - GUI.color = pawn.story.SkinColor; + GUI.color = SafeSkinColor(pawn); GUI.DrawTexture(rect, breast, ScaleMode.ScaleToFit); GUI.color = Color.white; GUI.DrawTexture(rect, areola, ScaleMode.ScaleToFit); @@ -454,5 +454,18 @@ namespace RJW_Menstruation if (pawn.IsAnimal() && !Configurations.EnableAnimalCycle) return false; return true; } + + // Apparently with some mods, even doing pawn.story?.SkinColor can throw a null reference, so we're stuck doing this + public static Color SafeSkinColor(Pawn pawn) + { + try + { + return pawn.story?.SkinColor ?? Color.white; + } + catch (NullReferenceException) + { + return Color.white; + } + } } }