[Android] DirectoryAdapter: blind fix for a crash that never happens
Edward Wang
git at videolan.org
Sat Mar 9 18:52:15 CET 2013
vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sat Mar 9 12:45:38 2013 -0500| [12503267013824532ad982f94aaccf96be519ece] | committer: Edward Wang
DirectoryAdapter: blind fix for a crash that never happens
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=12503267013824532ad982f94aaccf96be519ece
---
vlc-android/src/org/videolan/vlc/Util.java | 3 +++
vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java | 7 +++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/Util.java b/vlc-android/src/org/videolan/vlc/Util.java
index d5b6aa5..6a9dac2 100644
--- a/vlc-android/src/org/videolan/vlc/Util.java
+++ b/vlc-android/src/org/videolan/vlc/Util.java
@@ -83,6 +83,9 @@ public class Util {
}
public static String PathToURI(String path) {
+ if(path == null) {
+ throw new NullPointerException("Cannot convert null path!");
+ }
return LibVLC.nativeToURI(path);
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
index 4d19031..8d2a5b7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
@@ -361,8 +361,11 @@ public class DirectoryAdapter extends BaseAdapter {
this.mCurrentDir = null;
this.mCurrentRoot = null;
}
- } catch (URISyntaxException e) {
- e.printStackTrace();
+ } catch(URISyntaxException e) {
+ Log.e(TAG, "URISyntaxException in browse()", e);
+ return false;
+ } catch(NullPointerException e) {
+ Log.e(TAG, "NullPointerException in browse()", e);
return false;
}
}
More information about the Android
mailing list