server-beta icon indicating copy to clipboard operation
server-beta copied to clipboard

Fix NPC component cleanup

Open vincenzocorso opened this issue 2 months ago • 0 comments

This PR solves #1160.

Problem

NPCs were not removed from the player pool during NPCComponent::free, causing a crash.

During shutdown, the NPC network is destroyed while NPCs remain in the player pool. Later, when textdraws are destroyed in OnGameModeExit, a "hide textdraw" packet is sent to each player—including NPCs. This causes a crash when the packet is tried to be sent through the already-destroyed NPC network.

Solution

Release all NPCs before destroying the component, ensuring they're removed from the player pool

vincenzocorso avatar Jan 02 '26 18:01 vincenzocorso