catch bad paths passed to search activity. closes #801.
This commit is contained in:
Submodule src/SamsungPass updated: c8f1fb43f2...56538a5be1
@@ -84,11 +84,24 @@ namespace keepass2android.search
|
||||
if (intent.Action == Intent.ActionView)
|
||||
{
|
||||
var entryIntent = new Intent(this, typeof(EntryActivity));
|
||||
entryIntent.PutExtra(EntryActivity.KeyEntry, intent.Data.LastPathSegment);
|
||||
entryIntent.AddFlags(ActivityFlags.ForwardResult);
|
||||
Finish(); // Close this activity so that the entry activity is navigated to from the main activity, not this one.
|
||||
StartActivity(entryIntent);
|
||||
}
|
||||
ElementAndDatabaseId id;
|
||||
try
|
||||
{
|
||||
id = new ElementAndDatabaseId(intent.Data.LastPathSegment);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Kp2aLog.Log("Failed to transform " + intent.Data.LastPathSegment + " to an ElementAndDatabaseId object. ");
|
||||
Toast.MakeText(this, "Bad path passed. Please provide database and element ID.", ToastLength.Long).Show();
|
||||
Finish();
|
||||
return;
|
||||
}
|
||||
entryIntent.PutExtra(EntryActivity.KeyEntry, id.FullId);
|
||||
entryIntent.AddFlags(ActivityFlags.ForwardResult);
|
||||
Finish(); // Close this activity so that the entry activity is navigated to from the main activity, not this one.
|
||||
StartActivity(entryIntent);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Action may either by ActionSearch (from search widget) or null (if called from SearchActivity directly)
|
||||
|
||||
Submodule src/netftpandroid updated: e2c34d096a...099c7b6dd2
Reference in New Issue
Block a user