Commit 6ca6a5b3 authored by Grigory Fedorov's avatar Grigory Fedorov

ContactList: action null pointer exception fixed.

parent 7fc567c3
...@@ -208,44 +208,46 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -208,44 +208,46 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
switch (action) { if (action != null) {
case ContactList.ACTION_ROOM_INVITE: switch (action) {
case Intent.ACTION_SEND: case ContactList.ACTION_ROOM_INVITE:
case Intent.ACTION_CREATE_SHORTCUT: case Intent.ACTION_SEND:
if (Intent.ACTION_SEND.equals(action)) case Intent.ACTION_CREATE_SHORTCUT:
sendText = getIntent().getStringExtra(Intent.EXTRA_TEXT); if (Intent.ACTION_SEND.equals(action))
Toast.makeText(this, getString(R.string.select_contact), sendText = getIntent().getStringExtra(Intent.EXTRA_TEXT);
Toast.LENGTH_LONG).show(); Toast.makeText(this, getString(R.string.select_contact),
break; Toast.LENGTH_LONG).show();
case Intent.ACTION_VIEW: { break;
action = null; case Intent.ACTION_VIEW: {
Uri data = getIntent().getData(); action = null;
if (data != null && "xmpp".equals(data.getScheme())) { Uri data = getIntent().getData();
XMPPUri xmppUri; if (data != null && "xmpp".equals(data.getScheme())) {
try { XMPPUri xmppUri;
xmppUri = XMPPUri.parse(data); try {
} catch (IllegalArgumentException e) { xmppUri = XMPPUri.parse(data);
xmppUri = null; } catch (IllegalArgumentException e) {
} xmppUri = null;
if (xmppUri != null && "message".equals(xmppUri.getQueryType())) { }
ArrayList<String> texts = xmppUri.getValues("body"); if (xmppUri != null && "message".equals(xmppUri.getQueryType())) {
String text = null; ArrayList<String> texts = xmppUri.getValues("body");
if (texts != null && !texts.isEmpty()) String text = null;
text = texts.get(0); if (texts != null && !texts.isEmpty())
openChat(xmppUri.getPath(), text); text = texts.get(0);
openChat(xmppUri.getPath(), text);
}
} }
break;
} }
break; case Intent.ACTION_SENDTO: {
} action = null;
case Intent.ACTION_SENDTO: { Uri data = getIntent().getData();
action = null; if (data != null) {
Uri data = getIntent().getData(); String path = data.getPath();
if (data != null) { if (path != null && path.startsWith("/"))
String path = data.getPath(); openChat(path.substring(1), null);
if (path != null && path.startsWith("/")) }
openChat(path.substring(1), null); break;
} }
break;
} }
} }
if (Application.getInstance().doNotify()) { if (Application.getInstance().doNotify()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment