diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-11-09 16:18:53 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-11-09 16:18:53 +0100 |
commit | 87c4fd9050f76f4f17b61d96f71cc9f56edc724b (patch) | |
tree | 04f87a2e9792b80c40a0ae75a0a63e6ef2b7b32e /src/main/java/eu/siacs | |
parent | 8437dbd480749310c382d9cc915754b5f61709df (diff) |
return null if from ist not set in abstract stanza
Diffstat (limited to 'src/main/java/eu/siacs')
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java | 29 |
1 files 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"); |