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@gllm.fr>
This commit is contained in:
Mark Lee 2021-04-08 18:30:53 +01:00 committed by Thomas Guillem
parent e5416ddad2
commit 756618d02e
1 changed files with 2 additions and 2 deletions

View File

@ -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 =