From 3e31804fe5f24a11f98e23125cc18d5b1febffa5 Mon Sep 17 00:00:00 2001 From: Armand <4831c0@proton.me> Date: Tue, 16 Sep 2025 21:23:56 +0200 Subject: [PATCH] lesson: don't check the week if its empty --- firka/lib/ui/phone/widgets/lesson.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/firka/lib/ui/phone/widgets/lesson.dart b/firka/lib/ui/phone/widgets/lesson.dart index ab7695e5..dc0a0da6 100644 --- a/firka/lib/ui/phone/widgets/lesson.dart +++ b/firka/lib/ui/phone/widgets/lesson.dart @@ -38,10 +38,13 @@ class LessonWidget extends StatelessWidget { final isSubstituted = lesson.substituteTeacher != null; final isDismissed = lesson.type.name == "UresOra"; - final showBreak = - timeNow().isAfter(lesson.start) && timeNow().isBefore(lesson.end) || - timeNow().isAfter(week.last.end) || - lesson.start.getMidnight() != timeNow().getMidnight(); + var showBreak = false; + if (week.isNotEmpty) { + showBreak = + timeNow().isAfter(lesson.start) && timeNow().isBefore(lesson.end) || + timeNow().isAfter(week.last.end) || + lesson.start.getMidnight() != timeNow().getMidnight(); + } var accent = appStyle.colors.accent; var secondary = appStyle.colors.secondary;