Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an inconsistent crash during the intro dropships, which was introduced in #809. Oddly, this issue only seems to happen on dedicated servers.
Why this happens:
When the code runs
GetEntArrayByClass_Expensive( "info_spawnpoint_dropship_start" )
to get places to spawn the dropships, sometimes it will run before the server has finished loading all the ents, which can cause this to return an empty or incomplete list. There are no checks for this, so the code will continue running until it tries to put players in the dropship, which will cause it to crash due to the list being empty.The fix:
The prematch code will now wait until all entities have been loaded (
AddCallback_EntitiesDidLoad
). Additionally, the loop for spawning dropships has been updated to fix a rare case where too few or no dropships can spawn.Testing:
This fix (and several other attempts) has been extensively tested on the previous ikhadhonger servers. But to test this, simply start a dedicated server and switch maps several times. Without this PR it will eventually crash.