From 853e49a0779627873a2d52818edf800fc6804991 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 22 Oct 2016 09:57:26 +0200 Subject: [PATCH] - fixed: R_InitSkyMap must check for the null texture which cannot be used as a sky because it has no bitmap and will cause an access violation in the sky cap color calculation. --- src/r_sky.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/r_sky.cpp b/src/r_sky.cpp index 37312cbae..f29929c26 100644 --- a/src/r_sky.cpp +++ b/src/r_sky.cpp @@ -76,10 +76,20 @@ void R_InitSkyMap () int skyheight; FTexture *skytex1, *skytex2; + // Do not allow the null texture which has no bitmap and will crash. + if (sky1texture.isNull()) + { + sky1texture = TexMan.CheckForTexture("-noflat-", FTexture::TEX_Any); + } + if (sky2texture.isNull()) + { + sky2texture = TexMan.CheckForTexture("-noflat-", FTexture::TEX_Any); + } + skytex1 = TexMan(sky1texture, true); skytex2 = TexMan(sky2texture, true); - if (skytex1 == NULL) + if (skytex1 == nullptr) return; if ((level.flags & LEVEL_DOUBLESKY) && skytex1->GetHeight() != skytex2->GetHeight())