From 6ffb18c4b157f9efecec6a104ef930dd71f8b986 Mon Sep 17 00:00:00 2001
From: James R <justsomejames2@gmail.com>
Date: Tue, 19 Nov 2019 12:32:02 -0800
Subject: [PATCH] Warn if gametype number is out of range to map command

---
 src/d_netcmd.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/d_netcmd.c b/src/d_netcmd.c
index 8917156d7a..7a8cf539f6 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -1939,6 +1939,17 @@ static void Command_Map_f(void)
 				d = atoi(gametypename);
 				if (d >= 0 && d < NUMGAMETYPES)
 					newgametype = d;
+				else
+				{
+					CONS_Alert(CONS_ERROR,
+							"Gametype number %d is out of range. Use a number between"
+							" 0 and %d inclusive. ...Or just use the name. :v\n",
+							d,
+							NUMGAMETYPES-1);
+					Z_Free(realmapname);
+					Z_Free(mapname);
+					return;
+				}
 			}
 			else
 			{
-- 
GitLab