Permalink
Browse files

Merge pull request #328 from isRyven/fix-func-explosive-crash

renderer: fix crash caused by func_explosive
  • Loading branch information...
IR4T4 committed Oct 7, 2018
2 parents 8bff588 + 3167e25 commit 47a213fa3cb1e9cde3e25decab5ac30161f64974
Showing with 12 additions and 2 deletions.
  1. +4 −0 src/renderer/tr_image.c
  2. +8 −2 src/renderer2/tr_skin.c
View
@@ -1671,6 +1671,10 @@ qhandle_t RE_GetShaderFromModel(qhandle_t modelid, int surfnum, int withlightmap
msurface_t *surf;
shader_t *shd;
if (bmodel->numSurfaces == 0) {
return 0;
}
if (surfnum >= bmodel->numSurfaces) // if it's out of range, return the first surface
{
surfnum = 0;
View
@@ -210,9 +210,15 @@ qhandle_t RE_GetShaderFromModel(qhandle_t modelid, int surfnum, int withlightmap
bmodel = model->bsp;
if (bmodel && bmodel->firstSurface)
{
if (bmodel->numSurfaces == 0) {
Ren_Print("RE_GetShaderFromModel warning: no surface was found.\n");
return 0;
}
// if it's out of range, use the first surface
if (surfnum >= bmodel->numSurfaces)
{ // if it's out of range, return the first surface
Ren_Print("RE_GetShaderFromModel warning: surface is our of range.\n");
{
Ren_Print("RE_GetShaderFromModel warning: surface is out of range.\n");
surfnum = 0;
}

0 comments on commit 47a213f

Please sign in to comment.