[Android] Catch null pointer exception

Alexandre Perraud git at videolan.org
Thu May 16 18:24:15 CEST 2013


vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Thu May 16 16:44:51 2013 +0200| [569e75bd6201b0ff5694fab04df6745262d6698a] | committer: Jean-Baptiste Kempf

Catch null pointer exception

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

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

diff --git a/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java b/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
index 956a2eb..940f18c 100644
--- a/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
+++ b/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
@@ -71,7 +71,13 @@ public class LibVlcUtil {
         // If already checked return cached result
         if(errorMsg != null || isCompatible) return isCompatible;
 
-        ElfData elf = readLib(context.getFilesDir().getParent() +"/lib/libvlcjni.so");
+        ElfData elf;
+        try {
+            elf = readLib(context.getFilesDir().getParent() +"/lib/libvlcjni.so");
+        } catch (Exception e1) {
+            e1.printStackTrace();
+            elf = null;
+        }
         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