From 566b4a1626399b1c1621bf8b4ab1f8426c789c36 Mon Sep 17 00:00:00 2001
From: James R <justsomejames2@gmail.com>
Date: Sun, 29 Dec 2019 02:44:27 -0800
Subject: [PATCH] Don't let us warp to a map that doesn't exist (really!)

Okay so 6464df9876e472d1210aabce4237d02af38377e1, I WAS mistaken! Except that's
not how you check for a map's existence, at least not how the old map command
did it.
---
 src/g_game.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/g_game.c b/src/g_game.c
index e5bbf9d5dc..95aa1ae008 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -4580,6 +4580,10 @@ INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep)
 
 	if (usemapcode)
 	{
+		/* we can't check mapheaderinfo for this hahahaha */
+		if (W_CheckNumForName(G_BuildMapName(newmapnum)) == LUMPERROR)
+			return 0;
+
 		if (realmapnamep)
 			(*realmapnamep) = G_BuildMapTitle(newmapnum);
 	}
-- 
GitLab