diff --git a/app/src/main/java/com/brouken/player/SubtitleUtils.java b/app/src/main/java/com/brouken/player/SubtitleUtils.java index 8e52de5c..c28af301 100644 --- a/app/src/main/java/com/brouken/player/SubtitleUtils.java +++ b/app/src/main/java/com/brouken/player/SubtitleUtils.java @@ -190,24 +190,24 @@ public static DocumentFile findNext(DocumentFile video, DocumentFile dir) { return null; } - DocumentFile[] list = dir.listFiles(); try { + DocumentFile[] list = dir.listFiles(); Arrays.sort(list, (a, b) -> a.getName().compareToIgnoreCase(b.getName())); - } catch (NullPointerException e) { - return null; - } - final String videoName = video.getName(); - boolean matchFound = false; + final String videoName = video.getName(); + boolean matchFound = false; - for (DocumentFile file : list) { - if (file.getName().equals(videoName)) { - matchFound = true; - } else if (matchFound) { - if (isVideoFile(file)) { - return file; + for (DocumentFile file : list) { + if (file.getName().equals(videoName)) { + matchFound = true; + } else if (matchFound) { + if (isVideoFile(file)) { + return file; + } } } + } catch (NullPointerException e) { + e.printStackTrace(); } return null;