]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/dictionary/PreferenceActivity.java
Add a few null checks.
[Dictionary.git] / src / com / hughes / android / dictionary / PreferenceActivity.java
index a415d871a262839ce6ecdff1f6462b6b4c3fb81e..2d66bf945235b48375e5730005a689c89906a5fb 100644 (file)
@@ -104,9 +104,12 @@ public class PreferenceActivity extends android.preference.PreferenceActivity
                         dirs += "\n" + f.getAbsolutePath();
                 }
             } else {
-                String externalFilesDir = getApplicationContext().getExternalFilesDir(null).getAbsolutePath();
-                if (new File(externalFilesDir).canWrite())
-                    dirs += "\n" + externalFilesDir;
+                File efd = getApplicationContext().getExternalFilesDir(null);
+                if (efd != null) {
+                    String externalFilesDir = efd.getAbsolutePath();
+                    if (new File(externalFilesDir).canWrite())
+                        dirs += "\n" + externalFilesDir;
+                }
             }
             new AlertDialog.Builder(this).setTitle(getString(R.string.error))
                 .setMessage(getString(R.string.chosenNotWritable) + dirs)