diff --git a/webwhatsapi/js/wapi.js b/webwhatsapi/js/wapi.js index 74040ef6..39622885 100755 --- a/webwhatsapi/js/wapi.js +++ b/webwhatsapi/js/wapi.js @@ -284,7 +284,8 @@ window.WAPI.getAllGroups = function (done) { window.WAPI.getChat = function (id, done) { id = typeof id == "string" ? id : id._serialized; const found = window.Store.Chat.get(id); - found.sendMessage = (found.sendMessage) ? found.sendMessage : function () { return window.Store.sendMessage.apply(this, arguments); }; + if (found) + found.sendMessage = (found.sendMessage) ? found.sendMessage : function () { return window.Store.sendMessage.apply(this, arguments); }; if (done !== undefined) done(found); return found; }