diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java index f29c8bcf1..1bca84067 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java @@ -254,7 +254,9 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { throw new AlreadyLoggedInException(); } // Do partial version of nameprep on the username. - username = username.toLowerCase(Locale.US).trim(); + if (username != null) { + username = username.toLowerCase(Locale.US).trim(); + } if (saslAuthentication.hasNonAnonymousAuthentication()) { // Authenticate using SASL