mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-04-03 15:24:27 +02:00
[API/Librus] Fix attendance NPE.
This commit is contained in:
parent
9bda6c8869
commit
b8c5925e82
@ -13,6 +13,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Attendance
|
|||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
import pl.szczodrzynski.edziennik.utils.models.Time
|
||||||
|
|
||||||
class LibrusApiAttendances(override val data: DataLibrus,
|
class LibrusApiAttendances(override val data: DataLibrus,
|
||||||
override val lastSync: Long?,
|
override val lastSync: Long?,
|
||||||
@ -45,7 +46,7 @@ class LibrusApiAttendances(override val data: DataLibrus,
|
|||||||
val typeObject = data.attendanceTypes[type] ?: null
|
val typeObject = data.attendanceTypes[type] ?: null
|
||||||
val topic = typeObject?.name ?: ""
|
val topic = typeObject?.name ?: ""
|
||||||
|
|
||||||
val startTime = data.lessonRanges.get(lessonNo).startTime
|
val startTime = data.lessonRanges.get(lessonNo)?.startTime
|
||||||
|
|
||||||
val lesson = if (lessonId != -1L)
|
val lesson = if (lessonId != -1L)
|
||||||
data.librusLessons.singleOrNull { it.lessonId == lessonId }
|
data.librusLessons.singleOrNull { it.lessonId == lessonId }
|
||||||
@ -59,7 +60,7 @@ class LibrusApiAttendances(override val data: DataLibrus,
|
|||||||
semester,
|
semester,
|
||||||
topic,
|
topic,
|
||||||
lessonDate,
|
lessonDate,
|
||||||
startTime,
|
startTime ?: Time(0, 0, 0),
|
||||||
typeObject?.type ?: Attendance.TYPE_CUSTOM
|
typeObject?.type ?: Attendance.TYPE_CUSTOM
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user