From 7bfce1d1763f49719d8b4183aa5f710b16cbf348 Mon Sep 17 00:00:00 2001
From: ZZYZX <jewalky@gmail.com>
Date: Thu, 8 Oct 2015 21:16:30 +0300
Subject: [PATCH] Fixed crash in R_ClipSpriteColumnWithPortals if seg->curline
 is null

---
 src/r_things.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/r_things.cpp b/src/r_things.cpp
index d5c0489b3..cbcfbc295 100644
--- a/src/r_things.cpp
+++ b/src/r_things.cpp
@@ -331,6 +331,10 @@ bool R_ClipSpriteColumnWithPortals (fixed_t x, fixed_t y, vissprite_t* spr)
 		if (seg->CurrentPortalUniq != CurrentPortalUniq)
 			continue;
 
+		// I don't know what makes this happen (some old top-down portal code or possibly skybox code? something adds null lines...)
+		// crashes at the first frame of the first map of Action2.wad
+		if (!seg->curline) continue;
+
 		line_t* line = seg->curline->linedef;
 		// divline? wtf, anyway, divlines aren't supposed to be drawn. But I definitely saw NULL linedefs in drawsegs.
 		if (!line) continue;