mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-07 18:40:19 -05:00
fix nullpointerexception in importkeyactivity
This commit is contained in:
parent
0067cdf221
commit
3acb7fb087
@ -123,11 +123,16 @@ public class PgpImportExport {
|
||||
}
|
||||
|
||||
/** Imports keys from given data. If keyIds is given only those are imported */
|
||||
public ImportResult importKeyRings(List<ParcelableKeyRing> entries)
|
||||
throws PgpGeneralException, PGPException, IOException {
|
||||
public ImportResult importKeyRings(List<ParcelableKeyRing> entries) {
|
||||
|
||||
updateProgress(R.string.progress_importing, 0, 100);
|
||||
|
||||
// If there aren't even any keys, do nothing here.
|
||||
if (entries == null || entries.size() == 0) {
|
||||
return new ImportResult(
|
||||
ImportResult.RESULT_FAIL_NOTHING, mProviderHelper.getLog(), 0, 0, 0);
|
||||
}
|
||||
|
||||
int newKeys = 0, oldKeys = 0, badKeys = 0;
|
||||
|
||||
int position = 0;
|
||||
@ -165,6 +170,9 @@ public class PgpImportExport {
|
||||
newKeys += 1;
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
Log.e(Constants.TAG, "Encountered bad key on import!", e);
|
||||
++badKeys;
|
||||
} catch (PgpGeneralException e) {
|
||||
Log.e(Constants.TAG, "Encountered bad key on import!", e);
|
||||
++badKeys;
|
||||
|
@ -428,9 +428,14 @@ public class ImportKeysActivity extends ActionBarActivity {
|
||||
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
|
||||
// get returned data bundle
|
||||
Bundle returnData = message.getData();
|
||||
if (returnData == null) {
|
||||
return;
|
||||
}
|
||||
final ImportResult result =
|
||||
returnData.getParcelable(KeychainIntentService.RESULT);
|
||||
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
int resultType = result.getResult();
|
||||
|
||||
String str;
|
||||
|
@ -85,6 +85,10 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
|
||||
|
||||
public ArrayList<ImportKeysListEntry> getSelectedEntries() {
|
||||
ArrayList<ImportKeysListEntry> selectedData = new ArrayList<ImportKeysListEntry>();
|
||||
// Nothing to select, nvm.
|
||||
if (mData == null) {
|
||||
return selectedData;
|
||||
}
|
||||
for (ImportKeysListEntry entry : mData) {
|
||||
if (entry.isSelected()) {
|
||||
selectedData.add(entry);
|
||||
|
Loading…
Reference in New Issue
Block a user