Prevent crash when throwing Saber

seems it is indexing the g2 model surface that doesn't exist, might be something to do with the new hilt and the old hilt being in the save. Not sure, but this stops it crashing.
This commit is contained in:
Simon 2023-04-04 23:03:31 +01:00
parent d841464924
commit a3fdb460c4

View file

@ -1769,7 +1769,10 @@ void *G2_FindSurface(const model_s *mod, int index, int lod)
mdxmLODSurfOffset_t *indexes = (mdxmLODSurfOffset_t *)current;
// we are now looking at the offset array
assert(index>=0&&index<mod->mdxm->numSurfaces);
if (index >= mod->mdxm->numSurfaces)
{
index = mod->mdxm->numSurfaces-1;
}
current += indexes->offsets[index];
return (void *)current;