mikepenz / AboutLibraries

AboutLibraries automatically collects all dependencies and licenses of any gradle project (Kotlin MultiPlatform), and provides easy to integrate UI components for Android and Compose-jb environments
http://mikepenz.github.io/AboutLibraries/
Apache License 2.0
3.59k stars 419 forks source link

Sort a copy of the list of libraries to prevent a crash #967

Closed alexbakker closed 4 months ago

alexbakker commented 4 months ago

Previously, the following crash would occur if a libraryComparator is set:

java.lang.UnsupportedOperationException: Operation is not supported for read-only collection
    at kotlinx.collections.immutable.implementations.immutableList.AbstractListIterator.set(Unknown Source:4)
    at java.util.List.sort(List.java:533)
    at java.util.Collections.sort(Collections.java:210)
    at com.mikepenz.aboutlibraries.viewmodel.LibsViewModel$listItems$1$1.invokeSuspend(LibsViewModel.kt:95)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)