Skip to content

Fix crashes on empty auth responses and repeated reconnects after sign-in - #379

Merged
aonemd merged 3 commits into
masterfrom
fix-auth-and-signin-crashes
Oct 20, 2026
Merged

aonemd merged 3 commits into
masterfrom
fix-auth-and-signin-crashes

Conversation

@Keith-wright

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes two crashes where an exception escaped on the library's event thread.

It also adds tests for each case.

CHANGELOG

Keith-wright and others added 3 commits October 5, 2026 19:11
…n-in

Gson returns null for a null or empty authorizer response, and the
channel and sign-in code called methods on the result, so a
NullPointerException escaped on the event thread. Treat a null response
as an authorization failure.

InternalUser.disconnect() runs on every CONNECTING and DISCONNECTED state
change. After the first run cleared the user ID, the server-to-user
channel was still marked as subscribed, so the next run called getName()
without a user ID and threw. Only unsubscribe while there is a user ID,
and mark the channel unsubscribed.

Fixes #372
Fixes #367
disconnect() only cleaned up when the channel was SUBSCRIBED. If the
connection dropped while it was SUBSCRIBE_SENT, the channel stayed in
the ChannelManager after userId was cleared, so the reconnect's
resubscribe threw IllegalStateException from getName() and the next
signin failed with "Already subscribed".

Also adds an empty-string authorizer test for encrypted channels.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@aonemd
aonemd merged commit 2c04d07 into master Oct 20, 2026
6 checks passed
@aonemd
aonemd deleted the fix-auth-and-signin-crashes branch October 20, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants