[Android] Chapters and titles can be null
Geoffrey Métais
git at videolan.org
Fri Feb 2 10:10:24 CET 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Feb 2 09:41:40 2018 +0100| [8e1b480f02b4c321e0015a74458e80351cc1e760] | committer: Geoffrey Métais
Chapters and titles can be null
> https://code.videolan.org/videolan/vlc-android/commit/8e1b480f02b4c321e0015a74458e80351cc1e760
---
vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java | 2 +-
.../src/org/videolan/vlc/gui/dialogs/SelectChapterDialog.java | 6 ++----
vlc-android/src/org/videolan/vlc/media/PlayerController.kt | 4 ++--
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
index 4aadaf260..38340eded 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
@@ -364,7 +364,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
private void initChapters() {
final MediaPlayer.Chapter[] chapters = mService.getChapters(-1);
-
+ if (chapters == null) return;
int index = mService.getChapterIdx();
if (chapters[index].name == null || chapters[index].name.equals(""))
mChaptersTitle.setText(String.format("%s %d", getResources().getString(R.string.chapter), index));
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/SelectChapterDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/SelectChapterDialog.java
index ac7a06c03..badd12aa5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/SelectChapterDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/SelectChapterDialog.java
@@ -76,11 +76,9 @@ public class SelectChapterDialog extends DialogFragment implements PlaybackServi
private void initChapterList() {
final MediaPlayer.Chapter[] chapters = mService.getChapters(-1);
int chaptersCount = chapters != null ? chapters.length : 0;
- if (chaptersCount <= 1) {
- return;
- }
+ if (chaptersCount <= 1) return;
- List<Map<String, String>> chapterList = new ArrayList<Map<String, String>>();
+ final List<Map<String, String>> chapterList = new ArrayList<Map<String, String>>();
for (int i = 0; i < chaptersCount; i++) {
String name;
diff --git a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
index e50841770..6f1a9b7f7 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
@@ -218,9 +218,9 @@ class PlayerController : IVLCVout.Callback, MediaPlayer.EventListener {
fun navigate(where: Int) = mediaplayer.navigate(where)
- fun getChapters(title: Int) = mediaplayer.getChapters(title)
+ fun getChapters(title: Int): Array<out MediaPlayer.Chapter>? = mediaplayer.getChapters(title)
- fun getTitles() = mediaplayer.titles
+ fun getTitles(): Array<out MediaPlayer.Title>? = mediaplayer.titles
fun getChapterIdx() = mediaplayer.chapter
More information about the Android
mailing list