do not crash when inner message contains invalid jid

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/parser/MessageParser.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/parser/MessageParser.java 🔗

@@ -293,8 +293,8 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
 		}
 		boolean notify = false;
 
-		if (from == null) {
-			Log.d(Config.LOGTAG, "no from in: " + packet.toString());
+		if (from == null || !InvalidJid.isValid(from) || !InvalidJid.isValid(to)) {
+			Log.e(Config.LOGTAG, "encountered invalid message from='" + from + "' to='" + to + "'");
 			return;
 		}