2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-29 15:08:07 +03:00

Prevent crash "Cache_UnlinkLRU: NULL link" on client-side if aiment with sprite model will be to render as a studio model

This commit is contained in:
s1lentq 2024-01-14 00:18:08 +07:00
parent 32857e7785
commit 5002ff9abe

View File

@ -4698,11 +4698,25 @@ void SV_WriteEntitiesToClient(client_t *client, sizebuf_t *msg)
auto &entityState = curPack->entities[i];
if (entityState.number > MAX_CLIENTS)
{
if (sv_rehlds_attachedentities_playeranimationspeed_fix.string[0] == '1'
&& entityState.movetype == MOVETYPE_FOLLOW
&& 1 <= entityState.aiment && entityState.aiment <= MAX_CLIENTS)
if (entityState.movetype == MOVETYPE_FOLLOW && entityState.aiment > 0)
{
attachedEntCount[entityState.aiment]++;
if (sv_rehlds_attachedentities_playeranimationspeed_fix.string[0] == '1' &&
entityState.aiment <= MAX_CLIENTS)
{
attachedEntCount[entityState.aiment]++;
}
// Prevent crash "Cache_UnlinkLRU: NULL link" on client-side
// if aiment with sprite model will be to render as a studio model
if (entityState.aiment < g_psv.num_edicts)
{
edict_t *ent = &g_psv.edicts[entityState.aiment];
if ((ent->v.modelindex >= 0 && ent->v.modelindex < MAX_MODELS)
&& g_psv.models[ent->v.modelindex]->type != mod_studio)
{
entityState.aiment = 0;
}
}
}
// Prevent spam "Non-sprite set to glow!" in console on client-side