From bd0c80ebf30414deab823d0fcc8a62a3483b4062 Mon Sep 17 00:00:00 2001
From: Adhidarma Hadiwinoto <me@adhisimon.org>
Date: Mon, 31 Oct 2016 18:11:33 +0700
Subject: [PATCH] penanganan undefined resource

---
 matrix-util.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/matrix-util.js b/matrix-util.js
index ce9142a..bbdbad1 100644
--- a/matrix-util.js
+++ b/matrix-util.js
@@ -28,6 +28,10 @@ MatrixUtil.prototype.updateBuddyState = function(jid, state, statusText, resourc
     if (jid == 'undefined') {return; }
     jid = jid.toLowerCase();
 
+    if (!resource) {
+        resource = 'undefined';
+    }
+
     let logger = this.logger;
     let matrix = this.matrix;
 
@@ -131,7 +135,7 @@ MatrixUtil.prototype.updateLastIncoming = function(sender, msg) {
 MatrixUtil.prototype.updateLastOutgoing = function(destination, msg) {
     if (!destination) { return; }
     destination = destination.toLowerCase();
-    
+
     let matrix = this.matrix;
 
     if (!matrix) {
-- 
1.9.0