diff options
Diffstat (limited to 'Swiften/Serializer/AuthRequestSerializer.cpp')
-rw-r--r-- | Swiften/Serializer/AuthRequestSerializer.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Swiften/Serializer/AuthRequestSerializer.cpp b/Swiften/Serializer/AuthRequestSerializer.cpp index 32d733a..45b6503 100644 --- a/Swiften/Serializer/AuthRequestSerializer.cpp +++ b/Swiften/Serializer/AuthRequestSerializer.cpp @@ -16,7 +16,16 @@ AuthRequestSerializer::AuthRequestSerializer() { String AuthRequestSerializer::serialize(boost::shared_ptr<Element> element) const { boost::shared_ptr<AuthRequest> authRequest(boost::dynamic_pointer_cast<AuthRequest>(element)); - String value = (authRequest->getMessage().isEmpty() ? "=" : Base64::encode(authRequest->getMessage())); + String value; + boost::optional<ByteArray> message = authRequest->getMessage(); + if (message) { + if ((*message).isEmpty()) { + value = "="; + } + else { + value = Base64::encode(*message); + } + } return "<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"" + authRequest->getMechanism() + "\">" + value + "</auth>"; } |