BRoster::Private::SendTo(): Actually support NULL reply

Unlike documented passing a NULL reply would just fail instead of
sending the message without waiting for a reply.
This commit is contained in:
Ingo Weinhold 2014-06-17 09:39:28 +02:00
parent 820dbc01ce
commit b44215c079

View File

@ -48,7 +48,7 @@ BRoster::Private::SetTo(BMessenger mainMessenger, BMessenger mimeMessenger)
\param message The message to be sent.
\param reply A pointer to a pre-allocated BMessage into which the reply
message will be copied.
message will be copied. May be \c NULL.
\param mime \c true, if the message should be sent to the MIME data base
service, \c false for the roster.
\return
@ -65,10 +65,12 @@ BRoster::Private::SendTo(BMessage *message, BMessage *reply, bool mime)
if (fRoster == NULL)
return B_NO_INIT;
if (mime)
return fRoster->_MimeMessenger().SendMessage(message, reply);
const BMessenger& messenger = mime
? fRoster->_MimeMessenger() : fRoster->fMessenger;
return fRoster->fMessenger.SendMessage(message, reply);
return reply != NULL
? messenger.SendMessage(message, reply)
: messenger.SendMessage(message);
}