From a75048e20136bc5f8531380c114456463ac63fa9 Mon Sep 17 00:00:00 2001 From: Mohamed Zenadi Date: Tue, 17 Mar 2015 19:09:25 +0100 Subject: [PATCH] check that the data we get is not null --- app/src/main/java/com/zeapo/pwdstore/UserPreference.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java index 199d1172..48175167 100644 --- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java +++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java @@ -154,6 +154,9 @@ public class UserPreference extends ActionBarActivity implements Preference.OnPr case IMPORT_SSH_KEY: { try { + if (data.getData() == null) { + throw new IOException("Unable to open file"); + } copySshKey(data.getData()); Toast.makeText(this, this.getResources().getString(R.string.ssh_key_success_dialog_title), Toast.LENGTH_LONG).show(); setResult(RESULT_OK);