[Android] properly fix crash of last commit

Sébastien Toque git at videolan.org
Thu May 16 23:16:50 CEST 2013


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Thu May 16 21:10:57 2013 +0200| [870ec73999b2235039ea32f47759d354a93526d3] | committer: Sébastien Toque

properly fix crash of last commit

getFilesDir() try to create folders in internal memory, and return null if it fails.
getApplicationInfo().dataDir is better, can't fails (according to android source code),
and even if dataDir is null, readLib will just return null.

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

 vlc-android/src/org/videolan/libvlc/LibVlcUtil.java |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java b/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
index 940f18c..9f728b5 100644
--- a/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
+++ b/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
@@ -71,13 +71,7 @@ public class LibVlcUtil {
         // If already checked return cached result
         if(errorMsg != null || isCompatible) return isCompatible;
 
-        ElfData elf;
-        try {
-            elf = readLib(context.getFilesDir().getParent() +"/lib/libvlcjni.so");
-        } catch (Exception e1) {
-            e1.printStackTrace();
-            elf = null;
-        }
+        ElfData elf = readLib(context.getApplicationInfo().dataDir + "/lib/libvlcjni.so");
         if(elf == null) {
             Log.e(TAG, "WARNING: Unable to read libvlcjni.so; cannot check device ABI!");
             Log.e(TAG, "WARNING: Cannot guarantee correct ABI for this build (may crash)!");



More information about the Android mailing list