mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-14 03:30:53 +00:00
Gracefully handle case where /sdcard is removed or otherwise unavailable
This commit is contained in:
parent
dada329a8b
commit
55f04d4f68
@ -108,7 +108,9 @@ public class Apple2DisksMenu implements Apple2MenuView {
|
||||
sDataDir = pi.applicationInfo.dataDir;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(TAG, "" + e);
|
||||
System.exit(1);
|
||||
if (sDataDir == null) {
|
||||
sDataDir = "/data/local/tmp";
|
||||
}
|
||||
}
|
||||
|
||||
return sDataDir;
|
||||
@ -141,7 +143,6 @@ public class Apple2DisksMenu implements Apple2MenuView {
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "problem copying resources : " + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,6 +339,14 @@ public class Apple2DisksMenu implements Apple2MenuView {
|
||||
}
|
||||
});
|
||||
|
||||
// This appears to happen in cases where the external files directory String is valid, but is not actually mounted
|
||||
// We could probably check for more media "states" in the setup above ... but this defensive coding probably should
|
||||
// remain here after any refactoring =)
|
||||
if (files == null) {
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
|
||||
Arrays.sort(files);
|
||||
|
||||
getExternalStorageDirectory();
|
||||
|
Loading…
x
Reference in New Issue
Block a user