From 2b985bda857fabcd07710265cafdd68e9dabfd50 Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Thu, 28 Jul 2016 14:57:19 +0100
Subject: [PATCH] Make sure we detect if start >= numlines so we can deal with
 that properly

for some apparent reason the compiler didn't like the while loop condition edit on its own (it complained about inline failures for P_MobjReadyToTrigger for some reason), so I had to add that extra bit above the while loop... and it was happy again, huh
---
 src/p_spec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/p_spec.c b/src/p_spec.c
index 0bd530279c..e11235d81b 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -1188,7 +1188,10 @@ INT32 P_FindSpecialLineFromTag(INT16 special, INT16 tag, INT32 start)
 	{
 		start++;
 
-		while (lines[start].special != special)
+		if (start >= (INT32)numlines)
+			return -1;
+
+		while (start < (INT32)numlines && lines[start].special != special)
 			start++;
 
 		if (start >= (INT32)numlines)
-- 
GitLab