mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-24 07:58:50 -05:00
Add null check when retrieving key ids from contacts api
This commit is contained in:
parent
17e45d94a8
commit
8f616bcf0c
@ -45,6 +45,7 @@ import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
@ -151,6 +152,12 @@ public class ViewKeyActivity extends ActionBarActivity implements
|
||||
}
|
||||
if (mDataUri.getHost().equals(ContactsContract.AUTHORITY)) {
|
||||
mDataUri = ContactHelper.dataUriFromContactUri(this, mDataUri);
|
||||
if (mDataUri == null) {
|
||||
Log.e(Constants.TAG, "Contact Data missing. Should be uri of key!");
|
||||
Toast.makeText(this, R.string.error_contacts_key_id_missing, Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString());
|
||||
|
@ -261,6 +261,7 @@
|
||||
<string name="error_searching_keys">"An error occurred when searching for keys."</string>
|
||||
<string name="error_too_many_responses">"Key search query returned too many candidates. Please refine your query!"</string>
|
||||
<string name="error_too_short_or_too_many_responses">"Either no keys or too many have been found. Please improve your query!"</string>
|
||||
<string name="error_contacts_key_id_missing">"Retrieving the key ID from contacts failed!"</string>
|
||||
|
||||
<string name="error_import_no_valid_keys">"No valid keys found in File/Clipboard!"</string>
|
||||
<string name="error_generic_report_bug">"A generic error occurred, please create a new bug report for OpenKeychain."</string>
|
||||
|
Loading…
Reference in New Issue
Block a user