fix: NPE caused by sparseParcelableArray

This commit is contained in:
Ahmad Ansori Palembani 2024-06-09 16:41:16 +07:00
parent da4335d885
commit 6513d43f6e
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 9 additions and 1 deletions

View file

@ -33,6 +33,7 @@
- Fixed extension repo list did not update when a repo is added via deep link - Fixed extension repo list did not update when a repo is added via deep link
- Fixed download unread trying to download filtered (by scanlator) chapters - Fixed download unread trying to download filtered (by scanlator) chapters
- Fixed extensions not retaining their repo url - Fixed extensions not retaining their repo url
- Fixed more NullPointerException crashes
## Other ## Other
- Migrate some StorIO queries to SQLDelight, should improve stability - Migrate some StorIO queries to SQLDelight, should improve stability

View file

@ -24,4 +24,11 @@ fun <T : Parcelable?> Intent.getSparseParcelableArrayCompat(name: String, clazz:
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
fun <T : Parcelable?> Bundle.getSparseParcelableArrayCompat(name: String, clazz: Class<T>) = fun <T : Parcelable?> Bundle.getSparseParcelableArrayCompat(name: String, clazz: Class<T>) =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) getSparseParcelableArray(name, clazz) else getSparseParcelableArray<T>(name) try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) getSparseParcelableArray(
name,
clazz
) else getSparseParcelableArray<T>(name)
} catch (npe: NullPointerException) {
null
}