Skip to content

Commit

Permalink
Prevent crash "Cache_UnlinkLRU: NULL link" on client-side if aiment w…
Browse files Browse the repository at this point in the history
…ith sprite model will be to render as a studio model
  • Loading branch information
s1lentq committed Jan 13, 2024
1 parent 32857e7 commit 5002ff9
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions rehlds/engine/sv_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5002ff9

Please sign in to comment.