]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix a possible crash when an invalid skinframe gets accessed after cl.time steps...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 24 Sep 2010 21:37:43 +0000 (21:37 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 24 Sep 2010 21:44:04 +0000 (23:44 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10490 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=e63a0114bbd617c020c6217f5e1fe1145b1d2c78

gl_rmain.c

index 7cae34d3e374b9e4a81332a8b6401469fd41d2d9..45f80c00842f15c0038d7e145e72d9e69779887e 100644 (file)
@@ -9476,12 +9476,12 @@ texture_t *R_GetCurrentTexture(texture_t *t)
                        R_LoadQWSkin(&r_qwskincache[i], cl.scores[i].qw_skin);
                t->currentskinframe = r_qwskincache[i].skinframe;
                if (t->currentskinframe == NULL)
-                       t->currentskinframe = t->skinframes[(int)(t->skinframerate * (cl.time - rsurface.ent_shadertime)) % t->numskinframes];
+                       t->currentskinframe = t->skinframes[(unsigned int)(t->skinframerate * (cl.time - rsurface.ent_shadertime)) % t->numskinframes];
        }
        else if (t->numskinframes >= 2)
-               t->currentskinframe = t->skinframes[(int)(t->skinframerate * (cl.time - rsurface.ent_shadertime)) % t->numskinframes];
+               t->currentskinframe = t->skinframes[(unsigned int)(t->skinframerate * (cl.time - rsurface.ent_shadertime)) % t->numskinframes];
        if (t->backgroundnumskinframes >= 2)
-               t->backgroundcurrentskinframe = t->backgroundskinframes[(int)(t->backgroundskinframerate * (cl.time - rsurface.ent_shadertime)) % t->backgroundnumskinframes];
+               t->backgroundcurrentskinframe = t->backgroundskinframes[(unsigned int)(t->backgroundskinframerate * (cl.time - rsurface.ent_shadertime)) % t->backgroundnumskinframes];
 
        t->currentmaterialflags = t->basematerialflags;
        t->currentalpha = rsurface.colormod[3];