From 447558c5a64e28d0ac78edf9c5166c63b4a8b893 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ond=C5=99ej=20=C5=BDi=C5=BEka?= Date: Wed, 29 Jul 2009 22:56:12 +0200 Subject: [PATCH] [FIX] SMACK-264: NPE in SASLMechanism.java http://www.igniterealtime.org/issues/browse/SMACK-264 Signed-off-by: oezbek --- source/org/jivesoftware/smack/sasl/SASLMechanism.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/source/org/jivesoftware/smack/sasl/SASLMechanism.java b/source/org/jivesoftware/smack/sasl/SASLMechanism.java index b41c23b1..3d787003 100644 --- a/source/org/jivesoftware/smack/sasl/SASLMechanism.java +++ b/source/org/jivesoftware/smack/sasl/SASLMechanism.java @@ -149,10 +149,16 @@ public abstract class SASLMechanism implements CallbackHandler { response = sc.evaluateChallenge(null); } - String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES); - if(authenticationText.equals("")) { - authenticationText = "="; - } + String authenticationText; + if(response == null) { + authenticationText = null; + } else { + authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES); + } + + if(authenticationText == null || authenticationText.equals("")) { + authenticationText = "="; + } stanza.append(""); stanza.append(authenticationText); -- 2.11.4.GIT