stop parsing random strings as xmpp addresses when scanning uris
This commit is contained in:
parent
778cfa846b
commit
528f192f76
|
@ -21,6 +21,8 @@ import android.widget.AdapterView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -347,7 +349,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
|
||||||
private void handleActivityResult(ActivityResult activityResult) {
|
private void handleActivityResult(ActivityResult activityResult) {
|
||||||
if (activityResult.resultCode == RESULT_OK && activityResult.requestCode == ScanActivity.REQUEST_SCAN_QR_CODE) {
|
if (activityResult.resultCode == RESULT_OK && activityResult.requestCode == ScanActivity.REQUEST_SCAN_QR_CODE) {
|
||||||
String result = activityResult.data.getStringExtra(ScanActivity.INTENT_EXTRA_RESULT);
|
String result = activityResult.data.getStringExtra(ScanActivity.INTENT_EXTRA_RESULT);
|
||||||
XmppUri uri = new XmppUri(result == null ? "" : result);
|
XmppUri uri = new XmppUri(Strings.nullToEmpty(result));
|
||||||
if (uri.isValidJid()) {
|
if (uri.isValidJid()) {
|
||||||
showEnterJidDialog(uri);
|
showEnterJidDialog(uri);
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,11 +174,7 @@ public class XmppUri {
|
||||||
jid = null;
|
jid = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
jid = null;
|
||||||
jid = Jid.ofEscaped(uri.toString()).asBareJid().toEscapedString();
|
|
||||||
} catch (final IllegalArgumentException ignored) {
|
|
||||||
jid = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue