From b346dd0c09b146d6979fbac2bd6536719ce847cb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 13 May 2017 17:45:24 +0200 Subject: [PATCH] - added a check for unconnected linked line portals. --- src/portal.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/portal.cpp b/src/portal.cpp index 9926f289ec..0b74359a65 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -1027,8 +1027,17 @@ void P_CreateLinkedPortals() { if (linePortals[i].mType == PORTT_LINKED) { - if (CollectSectors(id, linePortals[i].mOrigin->frontsector)) id++; - if (CollectSectors(id, linePortals[i].mDestination->frontsector)) id++; + if (linePortals[i].mDestination == nullptr) + { + Printf("Linked portal on line %d is unconnected and will be disabled\n", linePortals[i].mOrigin->Index()); + linePortals[i].mOrigin->portalindex = UINT_MAX; + linePortals[i].mType = PORTT_VISUAL; + } + else + { + if (CollectSectors(id, linePortals[i].mOrigin->frontsector)) id++; + if (CollectSectors(id, linePortals[i].mDestination->frontsector)) id++; + } } }