Fix for a rare crash that happens when interpolating a model that uses the same frame twice in a row.
When interpolating a 3D model that has INTERPOLATEDOUBLEDFRAMES
enabled, this gets executed:
const FState *prevState = curState - 1;
if ( (curState->sprite == prevState->sprite) && ( curState->Frame == prevState->Frame) )
{
inter /= 2.;
inter += 0.5;
}
However, it seems that there's no guarantee that prevState = curState - 1
returns a valid pointer to an FState
object, and if that's the case, then it causes the game to crash when trying to access the invalid prevState
pointer. Adding this sanity check: ti->ActorInfo->OwnsState(prevState)
, should ensure that prevState
is validated first before trying to use it.