Don't report a channel join that leaving the server cut short

Connecting with a channel moves there once the channel list is in; if
the connection was left again before that, the move ran against the
closed socket and reported an error nobody could act on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 08:26:03 +00:00
parent 086b913c8e
commit 07aa7bd7f9

View File

@@ -404,6 +404,8 @@ public final class TeamspeakConnection implements TS3Listener {
*/ */
private void joinDefaultChannelIfNeeded(String channel, String channelPassword) { private void joinDefaultChannelIfNeeded(String channel, String channelPassword) {
if (normaliseChannelRef(channel) == null) return; if (normaliseChannelRef(channel) == null) return;
LocalTeamspeakClientSocket sock = client;
if (sock == null || !connected) return; // already left again
ChannelNode target = model.findChannelByPath(channel); ChannelNode target = model.findChannelByPath(channel);
if (target == null) { if (target == null) {
ui.onError("Channel \"" + channel.trim() + "\" not found on this server."); ui.onError("Channel \"" + channel.trim() + "\" not found on this server.");
@@ -411,9 +413,10 @@ public final class TeamspeakConnection implements TS3Listener {
} }
if (currentChannelId() == target.id) return; // clientinit already put us there if (currentChannelId() == target.id) return; // clientinit already put us there
try { try {
client.joinChannel(target.id, (channelPassword == null || channelPassword.isEmpty()) sock.joinChannel(target.id, (channelPassword == null || channelPassword.isEmpty())
? null : channelPassword); ? null : channelPassword);
} catch (Exception e) { } catch (Exception e) {
if (!connected) return;
error("Could not join channel \"" + target.name + "\": " + rootMessage(e)); error("Could not join channel \"" + target.name + "\": " + rootMessage(e));
} }
} }