mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-06 02:35:19 +08:00
Do not fail with NPE when scheme is null
Also remove some debug logging left by mistake.
This commit is contained in:
@@ -46,16 +46,6 @@ public class TermuxFileReceiverActivity extends Activity {
|
||||
final String type = intent.getType();
|
||||
final String scheme = intent.getScheme();
|
||||
|
||||
if (intent.getExtras() == null) {
|
||||
Log.e("termux", "NULL EXTRAS");
|
||||
} else {
|
||||
for (String key : intent.getExtras().keySet()) {
|
||||
Object value = intent.getExtras().get(key);
|
||||
Log.d("termux", String.format("Extra %s %s (%s)", key,
|
||||
value.toString(), value.getClass().getName()));
|
||||
}
|
||||
}
|
||||
|
||||
if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||
final String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||
final Uri sharedUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||
@@ -74,9 +64,9 @@ public class TermuxFileReceiverActivity extends Activity {
|
||||
} else {
|
||||
showErrorDialogAndQuit("Send action without content - nothing to save.");
|
||||
}
|
||||
} else if (scheme.equals("content")) {
|
||||
} else if ("content".equals(scheme)) {
|
||||
handleContentUri(intent.getData(), intent.getStringExtra(Intent.EXTRA_TITLE));
|
||||
} else if (scheme.equals("file")) {
|
||||
} else if ("file".equals(scheme)) {
|
||||
// When e.g. clicking on a downloaded apk:
|
||||
String path = intent.getData().getPath();
|
||||
File file = new File(path);
|
||||
@@ -87,7 +77,7 @@ public class TermuxFileReceiverActivity extends Activity {
|
||||
showErrorDialogAndQuit("Cannot open file: " + e.getMessage() + ".");
|
||||
}
|
||||
} else {
|
||||
showErrorDialogAndQuit("Unhandled scheme: " + intent.getScheme() + ".");
|
||||
showErrorDialogAndQuit("Unable to receive any file or URL.");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user