Commit 131ea90c8fe94a8b05c2c76dbc3c64d3785725e1

Authored by Adhidarma Hadiwinoto
1 parent fb48d75a33
Exists in master

jangan kirim pesan jika destination atau msg kosong

Showing 1 changed file with 9 additions and 0 deletions Side-by-side Diff

... ... @@ -102,6 +102,15 @@ function setOptions(options) {
102 102 }
103 103  
104 104 function sendMessage(destination, msg) {
  105 + if (!destination) {
  106 + logger.warn('adaptorXmpp.sendMessage: Undefined destination, send message aborted', {destination: destination, msg: msg});
  107 + }
  108 +
  109 + if (!msg) {
  110 + logger.warn('adaptorXmpp.sendMessage: Undefined message, send message aborted', {destination: destination, msg: msg});
  111 + }
  112 +
  113 +
105 114 if (destination.toLowerCase() != username.replace(/\/.*/, '').toLowerCase()) {
106 115 logger.verbose('Sending message', {from: username, destination: destination, msg: msg});
107 116 }