Avoid NPE when external storage is unavailable

This commit is contained in:
Aaron Culliney 2015-12-13 12:09:49 -08:00
parent b32a97b6fc
commit 2a51a62127

View File

@ -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());