From bd1ae7c796120919d375726924dca7547cef1245 Mon Sep 17 00:00:00 2001 From: Ahab Date: Tue, 10 Apr 2018 17:39:40 +0200 Subject: [PATCH] Fixed null messages --- src/com/em/miguelbridge/Launcher.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/com/em/miguelbridge/Launcher.java b/src/com/em/miguelbridge/Launcher.java index 9550eb6..b3836c3 100644 --- a/src/com/em/miguelbridge/Launcher.java +++ b/src/com/em/miguelbridge/Launcher.java @@ -71,16 +71,19 @@ public class Launcher { String matrixRoomId = (String) room.get("matrixid"); lastMessageId = getLastMessageId(matrixRoomId); - newMessaggio = (String[]) matrixBot.getLastMessage(matrixRoomId); + - if (!newMessaggio[0].equals(matrixBot.readBotUserName()) && - !newMessaggio[2].equals(lastMessageId) && - !newMessaggio[1].equals("") && newMessaggio[1] != null) { - String tgroomid = (String) room.get("tgid"); - tgBot.cEcho(tgroomid, newMessaggio[0] + ":\n" + newMessaggio[1]); - } + try { + newMessaggio = (String[]) matrixBot.getLastMessage(matrixRoomId); + if (!newMessaggio[0].equals(matrixBot.readBotUserName()) && + !newMessaggio[2].equals(lastMessageId) && + !newMessaggio[1].equals("") && newMessaggio[1] != null) { + String tgroomid = (String) room.get("tgid"); - saveLastMessageId(newMessaggio[2], matrixRoomId); + tgBot.cEcho(tgroomid, newMessaggio[0] + ":\n" + newMessaggio[1]); + saveLastMessageId(newMessaggio[2], matrixRoomId); + } + } catch (Exception e) {} } }