aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/xmpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs/conversations/xmpp')
-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");