From 2a51a62127774e470b95d1e80c08037abb102e63 Mon Sep 17 00:00:00 2001 From: Aaron Culliney Date: Sun, 13 Dec 2015 12:09:49 -0800 Subject: [PATCH] Avoid NPE when external storage is unavailable --- .../main/java/org/deadc0de/apple2ix/Apple2DisksMenu.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Android/app/src/main/java/org/deadc0de/apple2ix/Apple2DisksMenu.java b/Android/app/src/main/java/org/deadc0de/apple2ix/Apple2DisksMenu.java index 780eac16..ee34e1b8 100644 --- a/Android/app/src/main/java/org/deadc0de/apple2ix/Apple2DisksMenu.java +++ b/Android/app/src/main/java/org/deadc0de/apple2ix/Apple2DisksMenu.java @@ -136,6 +136,11 @@ public class Apple2DisksMenu implements Apple2MenuView { } public static void exposeAPKAssetsToExternal(Apple2Activity activity) { + getExternalStorageDirectory(activity); + if (sExternalFilesDir == null) { + return; + } + final ProgressBar bar = (ProgressBar) activity.findViewById(R.id.crash_progressBar); activity.runOnUiThread(new Runnable() { @Override @@ -149,7 +154,6 @@ public class Apple2DisksMenu implements Apple2MenuView { } }); - getExternalStorageDirectory(activity); Log.v(TAG, "Overwriting system files in /sdcard/apple2ix/ (external storage) ..."); recursivelyCopyAPKAssets(activity, /*from APK directory:*/"keyboards", /*to location:*/sExternalFilesDir.getAbsolutePath());