[Android] ThumbnailerManager: don't crash if we're unable to get a libvlc instance

Ludovic Fauvet git at videolan.org
Wed Oct 3 14:35:47 CEST 2012


vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Wed Oct  3 14:33:20 2012 +0200| [58ed0e26a673fb8e70166dd0acf701c651d5f516] | committer: Ludovic Fauvet

ThumbnailerManager: don't crash if we're unable to get a libvlc instance

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

 .../src/org/videolan/vlc/ThumbnailerManager.java       |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/ThumbnailerManager.java b/vlc-android/src/org/videolan/vlc/ThumbnailerManager.java
index b8aad5c..856c121 100644
--- a/vlc-android/src/org/videolan/vlc/ThumbnailerManager.java
+++ b/vlc-android/src/org/videolan/vlc/ThumbnailerManager.java
@@ -58,12 +58,6 @@ public class ThumbnailerManager implements Runnable {
     private final String mPrefix;
 
     public ThumbnailerManager(Context context, Display display) {
-        try {
-            mLibVlc = LibVLC.getInstance();
-        } catch (LibVlcException e) {
-            e.printStackTrace();
-        }
-
         mContext = context;
         DisplayMetrics metrics = new DisplayMetrics();
         display.getMetrics(metrics);
@@ -72,6 +66,16 @@ public class ThumbnailerManager implements Runnable {
     }
 
     public void start(VideoListFragment videoListFragment) {
+        if (mLibVlc == null) {
+            try {
+                mLibVlc = LibVLC.getInstance();
+            } catch (LibVlcException e) {
+                Log.e(TAG, "Can't obtain libvlc instance");
+                e.printStackTrace();
+                return;
+            }
+        }
+
         isStopping = false;
         if (mThread == null || mThread.getState() == State.TERMINATED) {
             mVideoListFragment = videoListFragment;



More information about the Android mailing list