return null if from ist not set in abstract stanza

This commit is contained in:
iNPUTmice 2014-11-09 16:18:53 +01:00
parent 8437dbd480
commit 87c4fd9050

View file

@ -11,20 +11,25 @@ public class AbstractStanza extends Element {
} }
public Jid getTo() { public Jid getTo() {
try { try {
return Jid.fromString(getAttribute("to")); return Jid.fromString(getAttribute("to"));
} catch (final InvalidJidException e) { } catch (final InvalidJidException e) {
return null; return null;
} }
} }
public Jid getFrom() { public Jid getFrom() {
try { String from = getAttribute("from");
return Jid.fromString(getAttribute("from")); if (from == null) {
} catch (final InvalidJidException e) { return null;
return null; } else {
} try {
} return Jid.fromString(from);
} catch (final InvalidJidException e) {
return null;
}
}
}
public String getId() { public String getId() {
return this.getAttribute("id"); return this.getAttribute("id");