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

@ -100,6 +100,7 @@ class _ProgramScreenState extends State<ProgramScreen> {
if (recordingInfo.recording.work != lastWorkId) {
lastWorkId = recordingInfo.recording.work;
workInfo = await backend.db.getWork(lastWorkId);
lastSectionIndex = null;
}
children.addAll([
@ -118,7 +119,7 @@ class _ProgramScreenState extends State<ProgramScreen> {
final sectionIndex = workInfo.sections
.lastIndexWhere((s) => s.beforePartIndex <= partId);
if (sectionIndex != lastSectionIndex) {
if (sectionIndex != lastSectionIndex && sectionIndex >= 0) {
lastSectionIndex = sectionIndex;
children.add(Padding(
padding: const EdgeInsets.only(