intent.getAction uri path may be null...generate empty string in that case
This commit is contained in:
parent
bda40fa331
commit
ca53c381aa
@ -201,9 +201,6 @@ public class IITC_Mobile extends Activity
|
|||||||
// handles ingress intel url intents, search intents, geo intents and javascript file intents
|
// handles ingress intel url intents, search intents, geo intents and javascript file intents
|
||||||
private void handleIntent(final Intent intent, final boolean onCreate) {
|
private void handleIntent(final Intent intent, final boolean onCreate) {
|
||||||
final String action = intent.getAction();
|
final String action = intent.getAction();
|
||||||
// intent MIME type may be null
|
|
||||||
final String type = intent.getType() == null ? "" : intent.getType();
|
|
||||||
|
|
||||||
if (Intent.ACTION_VIEW.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
|
if (Intent.ACTION_VIEW.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
|
||||||
final Uri uri = intent.getData();
|
final Uri uri = intent.getData();
|
||||||
Log.d("intent received url: " + uri.toString());
|
Log.d("intent received url: " + uri.toString());
|
||||||
@ -237,7 +234,10 @@ public class IITC_Mobile extends Activity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uri.getPath().endsWith(".user.js") || type.contains("javascript")) {
|
// intent MIME type and uri path may be null
|
||||||
|
final String type = intent.getType() == null ? "" : intent.getType();
|
||||||
|
final String path = uri.getPath() == null ? "" : uri.getPath();
|
||||||
|
if (path.endsWith(".user.js") || type.contains("javascript")) {
|
||||||
final Intent prefIntent = new Intent(this, IITC_PluginPreferenceActivity.class);
|
final Intent prefIntent = new Intent(this, IITC_PluginPreferenceActivity.class);
|
||||||
prefIntent.setDataAndType(uri, intent.getType());
|
prefIntent.setDataAndType(uri, intent.getType());
|
||||||
startActivity(prefIntent);
|
startActivity(prefIntent);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user