From 66b7597e87378b08d46b49e5289e29665d89958d Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Thu, 13 Aug 2015 16:59:32 +0100
Subject: [PATCH] Derp, disabling Polyobj_findExplicit apparently blocked off
 the one thing preventing ERZ2 from crashing before (since it has rogue spawn
 points without actual First Lines to go with them, for whatever reason)

---
 src/p_polyobj.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/p_polyobj.c b/src/p_polyobj.c
index 05cc03d34a..bd460b222f 100644
--- a/src/p_polyobj.c
+++ b/src/p_polyobj.c
@@ -657,6 +657,14 @@ static void Polyobj_spawnPolyObj(INT32 num, mobj_t *spawnSpot, INT32 id)
 		// TODO: sound sequence is in args[3]
 	}*/
 
+	// make sure array isn't empty
+	// since Polyobj_findExplicit is disabled currently, we have to do things here instead now!
+	if (po->segCount == 0)
+	{
+		po->isBad = true;
+		CONS_Debug(DBG_POLYOBJ, "Polyobject %d is empty\n", po->id);
+		return;
+	}
 
 	// set the polyobject's spawn spot
 	po->spawnSpot.x = spawnSpot->x;
-- 
GitLab