Skip to content

Commit f59b76b

Browse files
committed
Fix crash with new API 35 when removing last item from list
1 parent 7239713 commit f59b76b

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
## Added
1010
- Added Polish language by paplyke
1111

12+
## Fixed
13+
- Fix crash with new API 35 when removing last item from list (issue)[https://youtrack.jetbrains.com/issue/KT-71375/Prevent-Kotlins-removeFirst-and-removeLast-from-causing-crashes-on-Android-14-and-below-after-upgrading-to-Android-API-Level-35]
14+
15+
1216
## v[2.0.6]
1317
### Added
1418
- Add color picker [#101](https://github.com/AniLibApp/AniLib/issues/101)
@@ -67,6 +71,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6771
- **Note**: Any missing feature like filter settings will be added later on. ML translate is removed and won\'t be added.
6872
- **Enjoy AniLib!**
6973

74+
[v2.0.6]: https://github.com/AniLibApp/AniLib/compare/v2.0.3...v2.0.6
7075
[v2.0.3]: https://github.com/AniLibApp/AniLib/compare/v2.0.2...v2.0.3
7176
[v2.0.2]: https://github.com/AniLibApp/AniLib/compare/v2.0.1...v2.0.2
7277
[v2.0.1]: https://github.com/AniLibApp/AniLib/compare/v2.0.0...v2.0.1

app/src/main/kotlin/com/revolgenx/anilib/browse/ui/viewmodel/BrowseViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class BrowseViewModel(
140140
history.remove(search)
141141
history.add(0, search)
142142
if (history.size > 10) {
143-
history.removeLast()
143+
history.removeAt(history.lastIndex)
144144
}
145145
launch {
146146
appPreferencesDataStore.browseHistory.set(history.joinToString(searchSplitKeyword))

app/src/main/kotlin/com/revolgenx/anilib/list/ui/viewmodel/MediaListViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ abstract class MediaListViewModel(
245245
history.remove(search)
246246
history.add(0, search)
247247
if (history.size > 10) {
248-
history.removeLast()
248+
history.removeAt(history.lastIndex)
249249
}
250250
launch {
251251
appPreferencesDataStore.mediaListSearchHistory.set(

0 commit comments

Comments
 (0)