[Android] Check url validity before downloading

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


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

Check url validity before downloading

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

 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