[Android] Check url validity before downloading

Geoffrey Métais git at videolan.org
Wed Jun 22 18:10:08 CEST 2016


vlc-android | branch: 2.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jun 22 18:04:40 2016 +0200| [4a0848de93d8f2ad135492fbfd27b1d89e309d42] | committer: Geoffrey Métais

Check url validity before downloading

(cherry picked from commit 37498246893fa600feac2b786147e120727e78ca)

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

 vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java b/vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java
index 97637c7..a0cf59e 100644
--- a/vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java
+++ b/vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java
@@ -107,6 +107,8 @@ public class HttpImageLoader implements Callbacks {
         Bitmap icon = null;
         try {
             URL url = new URL(imageUrl);
+            if (url.getPort() <= 0)
+                return null;
             urlConnection = (HttpURLConnection) url.openConnection();
             InputStream in = new BufferedInputStream(urlConnection.getInputStream());
             icon = BitmapFactory.decodeStream(in);



More information about the Android mailing list