aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-11-09 16:18:53 +0100
committeriNPUTmice <daniel@gultsch.de>2014-11-09 16:18:53 +0100
commit87c4fd9050f76f4f17b61d96f71cc9f56edc724b (patch)
tree04f87a2e9792b80c40a0ae75a0a63e6ef2b7b32e
parent8437dbd480749310c382d9cc915754b5f61709df (diff)
return null if from ist not set in abstract stanza
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java29
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 54028a45c..eade220aa 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");