mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-19 00:16:48 -06:00
Fix timetable widget crash when there are no lessons for the day (#1737)
This commit is contained in:
parent
210c3a0e28
commit
ba02531aa4
@ -73,13 +73,12 @@ class TimetableWidgetFactory(
|
|||||||
updateTheme(appWidgetId)
|
updateTheme(appWidgetId)
|
||||||
lessons = getLessons(date, studentId)
|
lessons = getLessons(date, studentId)
|
||||||
|
|
||||||
if (date == LocalDate.now()) {
|
val todayLastLessonEndTimestamp = lessons.maxOfOrNull { it.end }
|
||||||
val todayLastLessonEndTimestamp =
|
if (date == LocalDate.now() && todayLastLessonEndTimestamp != null) {
|
||||||
lessons.maxOf { it.end }.toEpochSecond(ZoneOffset.UTC)
|
|
||||||
sharedPref.putLong(
|
sharedPref.putLong(
|
||||||
getTodayLastLessonEndDateTimeWidgetKey(appWidgetId),
|
key = getTodayLastLessonEndDateTimeWidgetKey(appWidgetId),
|
||||||
todayLastLessonEndTimestamp,
|
value = todayLastLessonEndTimestamp.toEpochSecond(ZoneOffset.UTC),
|
||||||
true
|
sync = true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user