From 050f3cff0dd18f76bff7448d61a4abff84e6a157 Mon Sep 17 00:00:00 2001 From: Jonas Kalderstam Date: Sun, 22 Sep 2024 21:01:08 +0200 Subject: [PATCH] Fixed runtime issue in Kotlin code --- .../com/nononsenseapps/feeder/model/html/LinearTextBuilder.kt | 4 ++-- .../nononsenseapps/feeder/ui/compose/text/AnnotatedString.kt | 2 +- .../com/nononsenseapps/feeder/ui/compose/text/HtmlComposer.kt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/nononsenseapps/feeder/model/html/LinearTextBuilder.kt b/app/src/main/java/com/nononsenseapps/feeder/model/html/LinearTextBuilder.kt index 9d6945f08..e4cfad31c 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/model/html/LinearTextBuilder.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/model/html/LinearTextBuilder.kt @@ -104,7 +104,7 @@ class LinearTextBuilder : Appendable { fun pop() { check(annotationsStack.isNotEmpty()) { "No annotation to pop" } // pop the last element - val item = annotationsStack.removeLast() + val item = annotationsStack.removeAt(annotationsStack.lastIndex) item.end = text.lastIndex } @@ -190,7 +190,7 @@ private fun CharSequence.secondToLast(): Char { private fun MutableList.pushMaxTwo(item: T) { this.add(0, item) if (count() > 2) { - this.removeLast() + this.removeAt(this.lastIndex) } } diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/text/AnnotatedString.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/text/AnnotatedString.kt index 1ed3340bb..3bda45d74 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/text/AnnotatedString.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/text/AnnotatedString.kt @@ -131,7 +131,7 @@ private fun CharSequence.secondToLast(): Char { private fun MutableList.pushMaxTwo(item: T) { this.add(0, item) if (count() > 2) { - this.removeLast() + this.removeAt(this.lastIndex) } } diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/text/HtmlComposer.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/text/HtmlComposer.kt index 1d7c8e2c2..f75f22a90 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/text/HtmlComposer.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/text/HtmlComposer.kt @@ -32,7 +32,7 @@ abstract class HtmlParser { annotation: String, ): Int = builder.pushStringAnnotation(tag = tag, annotation = annotation) - fun popSpan() = spanStack.removeLast() + fun popSpan() = spanStack.removeAt(spanStack.lastIndex) } inline fun HtmlParser.withParagraph(crossinline block: HtmlParser.() -> R): R {