diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaGetHomework.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaGetHomework.kt index 78abde37..32729a7e 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaGetHomework.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/synergia/LibrusSynergiaGetHomework.kt @@ -26,12 +26,15 @@ class LibrusSynergiaGetHomework(override val data: DataLibrus, event.attachmentIds = mutableListOf() event.attachmentNames = mutableListOf() - table[6].select("a").forEach { a -> - val attachmentId = a.attr("href").split('/') - .last().toLongOrNull() ?: return@forEach - val filename = a.text() - event.attachmentIds?.add(attachmentId) - event.attachmentNames?.add(filename) + + if (table.size > 6) { + table[6].select("a").forEach { a -> + val attachmentId = a.attr("href").split('/') + .last().toLongOrNull() ?: return@forEach + val filename = a.text() + event.attachmentIds?.add(attachmentId) + event.attachmentNames?.add(filename) + } } data.eventList.add(event)