From 4bafd622716f74df2c5d0b71a317c27257b83b4d Mon Sep 17 00:00:00 2001
From: Sally Coolatta <tehrealsalt@gmail.com>
Date: Sun, 25 Apr 2021 18:44:07 -0400
Subject: [PATCH] Only return skin string number if it existed

---
 src/m_cond.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/m_cond.c b/src/m_cond.c
index ee8e96d645..2fc730d3fa 100644
--- a/src/m_cond.c
+++ b/src/m_cond.c
@@ -508,9 +508,14 @@ INT32 M_UnlockableSkinNum(unlockable_t *unlock)
 	if (unlock->stringVar && strcmp(unlock->stringVar, ""))
 	{
 		// Get the skin from the string.
-		return R_SkinAvailable(unlock->stringVar);
+		INT32 skinnum = R_SkinAvailable(unlock->stringVar);
+		if (skinnum != -1)
+		{
+			return skinnum;
+		}
 	}
-	else if (unlock->variable >= 0 && unlock->variable < numskins)
+
+	if (unlock->variable >= 0 && unlock->variable < numskins)
 	{
 		// Use the number directly.
 		return unlock->variable;
@@ -532,9 +537,14 @@ INT32 M_EmblemSkinNum(emblem_t *emblem)
 	if (emblem->stringVar && strcmp(emblem->stringVar, ""))
 	{
 		// Get the skin from the string.
-		return R_SkinAvailable(emblem->stringVar);
+		INT32 skinnum = R_SkinAvailable(emblem->stringVar);
+		if (skinnum != -1)
+		{
+			return skinnum;
+		}
 	}
-	else if (emblem->var >= 0 && emblem->var < numskins)
+
+	if (emblem->var >= 0 && emblem->var < numskins)
 	{
 		// Use the number directly.
 		return emblem->var;
-- 
GitLab