MacGui: check if a chapter is not NULL before reading its duration
This commit is contained in:
parent
20c354333f
commit
158f694e43
@ -119,15 +119,17 @@ NSString *HBRangeChangedNotification = @"HBRangeChangedNotification";
|
||||
{
|
||||
if (self.type == HBRangeTypeChapters)
|
||||
{
|
||||
hb_title_t *title = self.title.hb_title;
|
||||
hb_chapter_t *chapter;
|
||||
int64_t duration = 0;
|
||||
hb_title_t *title = self.title.hb_title;
|
||||
|
||||
for (int i = self.chapterStart; i <= self.chapterStop; i++ )
|
||||
{
|
||||
chapter = (hb_chapter_t *) hb_list_item(title->list_chapter, i);
|
||||
hb_chapter_t *chapter = (hb_chapter_t *)hb_list_item(title->list_chapter, i);
|
||||
if (chapter)
|
||||
{
|
||||
duration += chapter->duration;
|
||||
}
|
||||
}
|
||||
|
||||
duration /= 90000; // pts -> seconds
|
||||
return [NSString stringWithFormat: @"%02lld:%02lld:%02lld", duration / 3600, ( duration / 60 ) % 60, duration % 60];
|
||||
|
Loading…
x
Reference in New Issue
Block a user