mobile: Fix handling of works without sections

This commit is contained in:
Elias Projahn 2020-05-13 22:05:18 +02:00
parent 3af7c23bbc
commit 0ccebb2217
3 changed files with 11 additions and 6 deletions

View file

@ -62,9 +62,11 @@ class _PlayerBarState extends State<PlayerBar> {
if (_partIds.isNotEmpty) {
subtitleBuffer.write(': ');
final section = _workInfo.sections
.lastWhere((s) => s.beforePartIndex <= _partIds[0]);
final section = _workInfo.sections.lastWhere(
(s) => s.beforePartIndex <= _partIds[0],
orElse: () => null,
);
if (section != null) {
subtitleBuffer.write(section.title);
subtitleBuffer.write(': ');