[Android] src: Prevent crash in VLCCrashHandler if SD card is not mounted

Edward Wang git at videolan.org
Tue Jul 3 16:47:19 CEST 2012


android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Tue Jul  3 10:47:00 2012 -0400| [1daac1b405dd8c2588e087c3ac00b4edcbf2c201] | committer: Edward Wang

src: Prevent crash in VLCCrashHandler if SD card is not mounted

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=1daac1b405dd8c2588e087c3ac00b4edcbf2c201
---

 vlc-android/src/org/videolan/vlc/VlcCrashHandler.java |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/VlcCrashHandler.java b/vlc-android/src/org/videolan/vlc/VlcCrashHandler.java
index 9d8bff5..5c39759 100644
--- a/vlc-android/src/org/videolan/vlc/VlcCrashHandler.java
+++ b/vlc-android/src/org/videolan/vlc/VlcCrashHandler.java
@@ -55,6 +55,10 @@ public class VlcCrashHandler implements UncaughtExceptionHandler {
         printWriter.close();
 
         Log.e(TAG, stacktrace);
+        if(!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+            defaultUEH.uncaughtException(thread, ex);
+            return; // We can't save the log if SD card is unavailable
+        }
         String sdcardPath = Environment.getExternalStorageDirectory().getPath();
         writeLog(stacktrace, sdcardPath + "/vlc_crash");
         writeLogcat(sdcardPath + "/vlc_logcat");



More information about the Android mailing list