[API/Librus] Fix getting homework without attachments.

This commit is contained in:
Kacper Ziubryniewicz 2020-04-02 09:37:22 +02:00
parent b052b5bd66
commit f5a7799924

View File

@ -26,12 +26,15 @@ class LibrusSynergiaGetHomework(override val data: DataLibrus,
event.attachmentIds = mutableListOf() event.attachmentIds = mutableListOf()
event.attachmentNames = mutableListOf() event.attachmentNames = mutableListOf()
table[6].select("a").forEach { a ->
val attachmentId = a.attr("href").split('/') if (table.size > 6) {
.last().toLongOrNull() ?: return@forEach table[6].select("a").forEach { a ->
val filename = a.text() val attachmentId = a.attr("href").split('/')
event.attachmentIds?.add(attachmentId) .last().toLongOrNull() ?: return@forEach
event.attachmentNames?.add(filename) val filename = a.text()
event.attachmentIds?.add(attachmentId)
event.attachmentNames?.add(filename)
}
} }
data.eventList.add(event) data.eventList.add(event)