From 87c4fd9050f76f4f17b61d96f71cc9f56edc724b Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Sun, 9 Nov 2014 16:18:53 +0100 Subject: [PATCH] return null if from ist not set in abstract stanza --- .../xmpp/stanzas/AbstractStanza.java | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java b/src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java index 54028a45..eade220a 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java +++ b/src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java @@ -11,20 +11,25 @@ public class AbstractStanza extends Element { } public Jid getTo() { - try { - return Jid.fromString(getAttribute("to")); - } catch (final InvalidJidException e) { - return null; - } - } + try { + return Jid.fromString(getAttribute("to")); + } catch (final InvalidJidException e) { + return null; + } + } public Jid getFrom() { - try { - return Jid.fromString(getAttribute("from")); - } catch (final InvalidJidException e) { - return null; - } - } + String from = getAttribute("from"); + if (from == null) { + return null; + } else { + try { + return Jid.fromString(from); + } catch (final InvalidJidException e) { + return null; + } + } + } public String getId() { return this.getAttribute("id");