[Android] Do not crash on DB Full when storing pictures...

Jean-Baptiste Kempf git at videolan.org
Wed Oct 31 20:42:35 CET 2012


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Oct 31 20:41:45 2012 +0100| [a32be448f6ff28a987684bb6bbb4184a6578f32d] | committer: Jean-Baptiste Kempf

Do not crash on DB Full when storing pictures...

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=a32be448f6ff28a987684bb6bbb4184a6578f32d
---

 vlc-android/src/org/videolan/vlc/Media.java |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/Media.java b/vlc-android/src/org/videolan/vlc/Media.java
index 18bf3cb..0453778 100644
--- a/vlc-android/src/org/videolan/vlc/Media.java
+++ b/vlc-android/src/org/videolan/vlc/Media.java
@@ -23,6 +23,7 @@ package org.videolan.vlc;
 import java.util.HashSet;
 
 import android.content.Context;
+import android.database.sqlite.SQLiteFullException;
 import android.graphics.Bitmap;
 import android.util.Log;
 
@@ -292,10 +293,15 @@ public class Media implements Comparable<Media> {
 
     public void setPicture(Context context, Bitmap p) {
         Log.d(TAG, "Set new picture for " + getTitle());
-        DatabaseManager.getInstance(context).updateMedia(
+        try {
+            DatabaseManager.getInstance(context).updateMedia(
                 mLocation,
                 DatabaseManager.mediaColumn.MEDIA_PICTURE,
                 p);
+        } catch (SQLiteFullException e) {
+            // TODO: do something clever
+            e.printStackTrace();
+        }
         mIsPictureParsed = true;
     }
 



More information about the Android mailing list