From ca53c381aaf673d2ad906f21805d70509b96e2e1 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Wed, 19 Feb 2014 01:21:13 +0100 Subject: [PATCH] intent.getAction uri path may be null...generate empty string in that case --- mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index a643e7f0..2f95caa5 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -201,9 +201,6 @@ public class IITC_Mobile extends Activity // handles ingress intel url intents, search intents, geo intents and javascript file intents private void handleIntent(final Intent intent, final boolean onCreate) { 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)) { final Uri uri = intent.getData(); 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); prefIntent.setDataAndType(uri, intent.getType()); startActivity(prefIntent);