Skip to content

Fix SV_SetClient_Ping crash due to unlinked client pointers#687

Merged
themuffinator merged 1 commit intomainfrom
fix-sv-setclient-ping-crash
Dec 7, 2025
Merged

Fix SV_SetClient_Ping crash due to unlinked client pointers#687
themuffinator merged 1 commit intomainfrom
fix-sv-setclient-ping-crash

Conversation

@google-labs-jules
Copy link
Contributor

Fixes a crash in SV_SetClient_Ping caused by client->edict->client being NULL. This happens if the engine iterates over clients (e.g. for ping updates) before the game DLL has fully connected the client to the entity.

Changes:

  • Modified AllocateClientArray in src/server/gameplay/g_clients.cpp to initialize g_entities[i+1].client for all allocated clients immediately.
  • Modified FreeClientArray in src/server/gameplay/g_clients.cpp to clear g_entities[i+1].client pointers before freeing memory.

PR created automatically by Jules for task 6581969964319597072 started by @themuffinator

SV_CalcPings in the engine can run before ClientConnect has fully linked
the entity to the client structure, causing a null pointer dereference
when accessing client->edict->client->ping.

This change ensures that g_entities[i].client pointers are set immediately
upon client array allocation in AllocateClientArray, and cleared in
FreeClientArray. This guarantees that valid client slots always have
a valid client pointer for the engine to access.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@themuffinator themuffinator marked this pull request as ready for review December 7, 2025 18:33
@themuffinator themuffinator merged commit a5b8cf9 into main Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant