From e7077ffbf49f7c1c745d07160e3a2da4970efe72 Mon Sep 17 00:00:00 2001 From: Odweta Date: Sat, 27 Apr 2024 08:02:46 +0200 Subject: [PATCH] fix app crash --- .../src/main/java/com/odweta/solon/Parsing.kt | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/mobile/app/src/main/java/com/odweta/solon/Parsing.kt b/mobile/app/src/main/java/com/odweta/solon/Parsing.kt index 6309546..823b2e2 100644 --- a/mobile/app/src/main/java/com/odweta/solon/Parsing.kt +++ b/mobile/app/src/main/java/com/odweta/solon/Parsing.kt @@ -237,17 +237,19 @@ class Parsing { } else { auxSubjects.add(subjects[i]) - var previous = auxSubjects[auxSubjects.size - 1].number.toInt() + 1 - val next = subjects[i + 1].number.toInt() - while (previous < next) { - auxSubjects.add( - Subject.freeSubject( - previous.toString(), - subjects[i-1].end, - subjects[i+1].start + if (auxSubjects[auxSubjects.size - 1].number.toIntOrNull() != null) { + var previous = auxSubjects[auxSubjects.size - 1].number.toInt() + 1 + val next = subjects[i + 1].number.toInt() + while (previous < next) { + auxSubjects.add( + Subject.freeSubject( + previous.toString(), + subjects[i-1].end, + subjects[i+1].start + ) ) - ) - previous += 1 + previous += 1 + } } } } @@ -352,4 +354,4 @@ class Parsing { return marks } } -} \ No newline at end of file +}