[Android] Don't return 0-sized image

Geoffrey Métais git at videolan.org
Tue Feb 14 18:54:39 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb 14 15:39:47 2017 +0100| [ce020d0ada1c44de4bae32379232a77e5614a799] | committer: Geoffrey Métais

Don't return 0-sized image

> https://code.videolan.org/videolan/vlc-android/commit/ce020d0ada1c44de4bae32379232a77e5614a799
---

 vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java b/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java
index 8b15eef..8c54318 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java
@@ -390,8 +390,10 @@ public class AudioUtil {
             options.inSampleSize = 1;
 
             // Find the best decoding scale for the bitmap
-            while( options.outWidth / options.inSampleSize > width)
-                options.inSampleSize = options.inSampleSize * 2;
+            if (width > 0) {
+                while (options.outWidth / options.inSampleSize > width)
+                    options.inSampleSize = options.inSampleSize * 2;
+            }
 
             // Decode the file (with memory allocation this time)
             cover = BitmapFactory.decodeFile(path, options);



More information about the Android mailing list