Skip to content

Fix softlocking as Sonic & Tails when Player 2 has no name

Hanicef requested to merge Hanicef/SRB2:fix-softlock-empty-name into next

When starting a game of Sonic & Tails on Singleplayer, the client part of the game will send the name strings of the players to the server. Since Tails is considered a player, the game will send Player 2's name to the server for Tails, but the problem is that if that string is empty, it won't be sanitized properly to avoid trashing the real Player 2's name. As a result, it sends the empty string directly to the server, which is considered invalid and the server drops the packet. The result is that the client is now waiting infinitely for the server to start the game, and the server is waiting infinitely for the client to send a (valid) join packet, hence the softlock.

The solution is to simply always send a non-empty string when a bot is playing as Player 2, as the player name really doesn't matter in this case.

Fixes: https://mb.srb2.org/threads/v2-2-10-sp-game-not-starting-as-sonic-tails-if-player-2-has-no-name.37323/

Merge request reports