[Android] fix URItoFileName when there is no dot

Sébastien Toque git at videolan.org
Mon Jul 23 19:53:21 CEST 2012


android | branch: master | Sébastien Toque <xilasz at gmail.com> | Mon Jul 23 16:48:11 2012 +0200| [8672b29a03a1e938f65ee4567f22eb3cae71d17b] | committer: Sébastien Toque

fix URItoFileName when there is no dot

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=8672b29a03a1e938f65ee4567f22eb3cae71d17b
---

 vlc-android/src/org/videolan/vlc/Util.java |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/Util.java b/vlc-android/src/org/videolan/vlc/Util.java
index 55627c7..bd5ab98 100644
--- a/vlc-android/src/org/videolan/vlc/Util.java
+++ b/vlc-android/src/org/videolan/vlc/Util.java
@@ -56,7 +56,8 @@ public class Util {
     public static String URItoFileName(String URI) {
         int sep = URI.lastIndexOf('/');
         int dot = URI.lastIndexOf('.');
-        return Uri.decode(URI.substring(sep + 1, dot));
+        String name = dot >= 0 ? URI.substring(sep + 1, dot) : URI;
+        return Uri.decode(name);
     }
 
     public static String PathToURI(String path) {



More information about the Android mailing list