diff --git a/app/src/main/java/handlers/OrtcHandler.java b/app/src/main/java/handlers/OrtcHandler.java index 1770457..0bca1b9 100644 --- a/app/src/main/java/handlers/OrtcHandler.java +++ b/app/src/main/java/handlers/OrtcHandler.java @@ -143,7 +143,14 @@ public void sendMsg(Message msg, String channel) { public void handleMessage(String msg, String channel){ SimpleDateFormat sdf = new SimpleDateFormat(Config.DATE_FORMAT); - Message newMsg = new Message(msg.substring(0,msg.indexOf(":")), msg.substring(msg.indexOf(":")+1),sdf.format(new Date())); + Message newMsg = null; + if(msg.contains(":")) + { + newMsg = new Message(msg.substring(0, msg.indexOf(":")), msg.substring(msg.indexOf(":") + 1), sdf.format(new Date())); + } + else { + newMsg = new Message("Unknown user", msg, sdf.format(new Date())); + } Channel list = messages.get(channel); list.setUnRead(list.getUnRead() + 1); @@ -154,6 +161,7 @@ public void handleMessage(String msg, String channel){ if(chatRoom != null) chatRoom.refreshData(newMsg); + } }