From 508536e3d7433fae8f8c9782cfe22e8c5aefd416 Mon Sep 17 00:00:00 2001
From: spherallic <spherallic@gmail.com>
Date: Mon, 5 Sep 2022 20:41:09 +0200
Subject: [PATCH] Fix map number checks when reading unlockable conditions.

---
 src/deh_soc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/deh_soc.c b/src/deh_soc.c
index 9e3c2f242..ecf930bd9 100644
--- a/src/deh_soc.c
+++ b/src/deh_soc.c
@@ -3307,7 +3307,7 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
 		else
 			re = atoi(params[1]);
 
-		if (re < 0 || re >= NUMMAPS)
+		if (re <= 0 || re > NUMMAPS)
 		{
 			deh_warning("Level number %d out of range (1 - %d)", re, NUMMAPS);
 			return;
@@ -3327,7 +3327,7 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
 		else
 			x1 = (INT16)atoi(params[1]);
 
-		if (x1 < 0 || x1 >= NUMMAPS)
+		if (x1 <= 0 || x1 > NUMMAPS)
 		{
 			deh_warning("Level number %d out of range (1 - %d)", re, NUMMAPS);
 			return;
@@ -3362,7 +3362,7 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
 		else
 			x1 = (INT16)atoi(params[1]);
 
-		if (x1 < 0 || x1 >= NUMMAPS)
+		if (x1 <= 0 || x1 > NUMMAPS)
 		{
 			deh_warning("Level number %d out of range (1 - %d)", re, NUMMAPS);
 			return;
-- 
GitLab