prevent QR code parser from crashing fixed #839
This commit is contained in:
parent
bdb335e6b0
commit
2679824770
|
@ -18,9 +18,13 @@ public class XmppUri {
|
||||||
try {
|
try {
|
||||||
parse(Uri.parse(uri));
|
parse(Uri.parse(uri));
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
|
try {
|
||||||
|
jid = Jid.fromString(uri).toBareJid().toString();
|
||||||
|
} catch (InvalidJidException e2) {
|
||||||
jid = null;
|
jid = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public XmppUri(Uri uri) {
|
public XmppUri(Uri uri) {
|
||||||
parse(uri);
|
parse(uri);
|
||||||
|
@ -42,6 +46,13 @@ public class XmppUri {
|
||||||
try {
|
try {
|
||||||
jid = URLDecoder.decode(uri.getEncodedPath(), "UTF-8").split("/")[1];
|
jid = URLDecoder.decode(uri.getEncodedPath(), "UTF-8").split("/")[1];
|
||||||
} catch (final UnsupportedEncodingException ignored) {
|
} catch (final UnsupportedEncodingException ignored) {
|
||||||
|
jid = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
jid = Jid.fromString(uri.toString()).toBareJid().toString();
|
||||||
|
} catch (final InvalidJidException ignored) {
|
||||||
|
jid = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +73,7 @@ public class XmppUri {
|
||||||
|
|
||||||
public Jid getJid() {
|
public Jid getJid() {
|
||||||
try {
|
try {
|
||||||
return Jid.fromString(this.jid);
|
return this.jid == null ? null :Jid.fromString(this.jid);
|
||||||
} catch (InvalidJidException e) {
|
} catch (InvalidJidException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -71,8 +82,4 @@ public class XmppUri {
|
||||||
public String getFingerprint() {
|
public String getFingerprint() {
|
||||||
return this.fingerprint;
|
return this.fingerprint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMuc() {
|
|
||||||
return this.muc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue