Skip to content

Commit

Permalink
fixup! Allow message and presencemessage to work without data
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Woolf committed May 12, 2015
1 parent 19ca641 commit 448b73f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions common/lib/types/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@ var Message = (function() {
};

Message.encode = function(msg, options) {
if(msg.data){
var data = msg.data, encoding;
if(typeof(data) != 'string' && !BufferUtils.isBuffer(data)) {
msg.data = JSON.stringify(data);
msg.encoding = (encoding = msg.encoding) ? (encoding + '/json') : 'json';
}
var data = msg.data, encoding;
if(data && typeof(data) != 'string' && !BufferUtils.isBuffer(data)) {
msg.data = JSON.stringify(data);
msg.encoding = (encoding = msg.encoding) ? (encoding + '/json') : 'json';
}
if(options != null && options.encrypted)
Message.encrypt(msg, options);
Expand Down

0 comments on commit 448b73f

Please sign in to comment.