From 49b8fd6d67e308950f67dda75fa71816f50eb6ce Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Tue, 13 Feb 2018 21:12:42 +0000
Subject: [PATCH] Don't attempt to load the "Lua/" or "SOCs/" folder lumps
 themselves as Lua/SOC lumps

---
 src/w_wad.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/w_wad.c b/src/w_wad.c
index c9330a7ebc..1b0e501a63 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -190,6 +190,7 @@ static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum)
 	if (posStart != INT16_MAX)
 	{
 		posEnd = W_CheckNumForFolderEndPK3("Lua/", wadnum, posStart);
+		posStart++; // first "lump" will be "Lua/" folder itself, so ignore it
 		for (; posStart < posEnd; posStart++)
 			LUA_LoadLump(wadnum, posStart);
 	}
@@ -197,6 +198,7 @@ static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum)
 	if (posStart != INT16_MAX)
 	{
 		posEnd = W_CheckNumForFolderEndPK3("SOCs/", wadnum, posStart);
+		posStart++; // first "lump" will be "SOCs/" folder itself, so ignore it
 		for(; posStart < posEnd; posStart++)
 		{
 			lumpinfo_t *lump_p = &wadfiles[wadnum]->lumpinfo[posStart];
-- 
GitLab