[vlc-commits] libvlc: fix title count conditional for chapter descriptions

Mark Lee git at videolan.org
Mon Apr 12 07:07:09 UTC 2021


vlc | branch: master | Mark Lee <mark.lee at capricasoftware.co.uk> | Thu Apr  8 18:30:53 2021 +0100| [756618d02e6978db1bbfbe8a4ed94a512db453ca] | committer: Thomas Guillem

libvlc: fix title count conditional for chapter descriptions

Chapter descriptions were not being returned for valid title
indices.

The conditional check would return true (and therefore abort the
method) when the requested title index was less than the title
count, i.e. when it was valid.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=756618d02e6978db1bbfbe8a4ed94a512db453ca
---

 lib/media_player.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/media_player.c b/lib/media_player.c
index 9341c49a68..61c354517f 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -1364,7 +1364,7 @@ int libvlc_media_player_get_chapter_count_for_title(
         goto end;
 
     size_t titles_count = vlc_player_title_list_GetCount(titles);
-    if (idx < titles_count)
+    if (idx >= titles_count)
        goto end;
 
     const struct vlc_player_title *title =
@@ -1489,7 +1489,7 @@ int libvlc_media_player_get_full_chapter_descriptions( libvlc_media_player_t *p_
         goto end;
 
     size_t titles_count = vlc_player_title_list_GetCount(titles);
-    if (i_chapters_of_title < (int) titles_count)
+    if (i_chapters_of_title >= (int) titles_count)
        goto end;
 
     const struct vlc_player_title *title =



More information about the vlc-commits mailing list