Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when the entity with aiment doesn't have a model #1

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions rehlds/engine/sv_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4904,8 +4904,9 @@ void SV_WriteEntitiesToClient(client_t *client, sizebuf_t *msg)
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)
if (ent->v.modelindex >= 0 && ent->v.modelindex < MAX_MODELS
&& (!g_psv.models[ent->v.modelindex]
|| g_psv.models[ent->v.modelindex]->type != mod_studio))
{
entityState.aiment = 0;
}
Expand All @@ -4915,6 +4916,7 @@ void SV_WriteEntitiesToClient(client_t *client, sizebuf_t *msg)
// Prevent spam "Non-sprite set to glow!" in console on client-side
if (entityState.rendermode == kRenderGlow
&& (entityState.modelindex >= 0 && entityState.modelindex < MAX_MODELS)
&& g_psv.models[entityState.modelindex]
&& g_psv.models[entityState.modelindex]->type != mod_sprite)
{
entityState.rendermode = kRenderNormal;
Expand Down
Loading