fix crash from dodgy skies.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4945 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2015-07-14 15:50:18 +00:00
parent dca5fee18a
commit 9ecc276ce3

View file

@ -759,6 +759,15 @@ void R_InitSky (shader_t *shader, const char *skyname, qbyte *src, unsigned int
if (width < 1 || height < 1 || stride != width*2)
return;
if (width*height > countof(trans))
{
unsigned int wibuf[16] = {0};
shader->defaulttextures->base = R_LoadTexture("$blackimage", 4, 4, TF_RGBA32, wibuf, IF_NOMIPMAP|IF_NOPICMIP|IF_NEAREST|IF_NOGAMMA);
shader->defaulttextures->base = R_LoadReplacementTexture(skyname, NULL, 0, src, stride, height, TF_SOLID8);
shader->defaulttextures->fullbright = shader->defaulttextures->base;
return;
}
// make an average value for the back to avoid
// a fringe on the top level