From 7ffc2f12753eae3222ddeb77aa66328b189644e7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 13 Dec 2018 23:25:55 +0100 Subject: [PATCH] - fixed invalid texture accesses in the software renderer. --- src/swrenderer/line/r_line.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/swrenderer/line/r_line.cpp b/src/swrenderer/line/r_line.cpp index 0a376c791..a72b697b1 100644 --- a/src/swrenderer/line/r_line.cpp +++ b/src/swrenderer/line/r_line.cpp @@ -453,10 +453,10 @@ namespace swrenderer swal = draw_segment->swall; FTexture *tex = TexMan.GetPalettedTexture(sidedef->GetTexture(side_t::mid), true); FSoftwareTexture *pic = tex && tex->isValid()? tex->GetSoftwareTexture() : nullptr; - double yscale = pic->GetScale().Y * sidedef->GetTextureYScale(side_t::mid); + double yscale = (pic? pic->GetScale().Y : 1.0) * sidedef->GetTextureYScale(side_t::mid); fixed_t xoffset = FLOAT2FIXED(sidedef->GetTextureXOffset(side_t::mid)); - if (pic->useWorldPanning()) + if (pic && pic->useWorldPanning()) { xoffset = xs_RoundToInt(xoffset * lwallscale); } @@ -877,6 +877,7 @@ namespace swrenderer auto tex = TexMan.GetPalettedTexture(sidedef->GetTexture(side_t::mid), true); mMiddlePart.Texture = tex && tex->isValid() ? tex->GetSoftwareTexture() : nullptr; + if (mMiddlePart.Texture == nullptr) return; mMiddlePart.TextureOffsetU = FLOAT2FIXED(sidedef->GetTextureXOffset(side_t::mid)); double rowoffset = sidedef->GetTextureYOffset(side_t::mid); mMiddlePart.TextureScaleU = sidedef->GetTextureXScale(side_t::mid);