[Android] Prevent NoSuchElementException at mount parsing

Geoffrey Métais git at videolan.org
Thu Nov 16 11:38:54 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Nov 16 09:19:39 2017 +0100| [d26174569fe8e3ed123d3e633b11439fdb16a3dd] | committer: Geoffrey Métais

Prevent NoSuchElementException at mount parsing

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

 vlc-android/src/org/videolan/vlc/util/AndroidDevices.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
index fccba6785..0a31f7a9d 100644
--- a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
+++ b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
@@ -129,7 +129,7 @@ public class AndroidDevices {
                 final StringTokenizer tokens = new StringTokenizer(line, " ");
                 final String device = tokens.nextToken();
                 final String mountpoint = tokens.nextToken();
-                final String type = tokens.nextToken();
+                final String type = tokens.hasMoreTokens() ? tokens.nextToken() : null;
 
                 // skip if already in list or if type/mountpoint is blacklisted
                 if (list.contains(mountpoint) || typeBL.contains(type) || Strings.startsWith(mountBL, mountpoint))



More information about the Android mailing list