Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Mar 23, 2024

Conversation

alexbakker
Copy link
Contributor

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)

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)
```
Copy link
Owner

@mikepenz mikepenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the PR!

@mikepenz mikepenz added the fix label Mar 23, 2024
@mikepenz mikepenz merged commit 3d60dc9 into mikepenz:develop Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants