[Android] AudioUtil: fix getCover crash
Jean-Baptiste Kempf
git at videolan.org
Wed Oct 31 19:32:03 CET 2012
vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Oct 31 19:31:35 2012 +0100| [7573d27b6760a940c57cab595daef6f5b2a5f252] | committer: Jean-Baptiste Kempf
AudioUtil: fix getCover crash
Close #7686
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=7573d27b6760a940c57cab595daef6f5b2a5f252
---
vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
index a9daccd..e36441d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
@@ -151,11 +151,12 @@ public class AudioUtil {
private static String getCoverFromFolder(Context context, Media media) {
File f = Util.URItoFile(media.getLocation());
- for (File s : f.getParentFile().listFiles()) {
- if (s.getAbsolutePath().endsWith("png") ||
- s.getAbsolutePath().endsWith("jpg"))
- return s.getAbsolutePath();
- }
+ if (f != null && f.getParentFile() != null && f.getParentFile().listFiles() != null)
+ for (File s : f.getParentFile().listFiles()) {
+ if (s.getAbsolutePath().endsWith("png")
+ || s.getAbsolutePath().endsWith("jpg"))
+ return s.getAbsolutePath();
+ }
return null;
}
More information about the Android
mailing list