mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Probably fixed a very weird exception
This commit is contained in:
parent
e7d7639776
commit
3fa82cdba7
1 changed files with 4 additions and 3 deletions
|
@ -38,8 +38,9 @@ class APIRepository(val api: MainAPI) {
|
|||
val hash: Pair<String, String>
|
||||
)
|
||||
|
||||
|
||||
private val cache: ArrayList<SavedLoadResponse> = arrayListOf()
|
||||
// This really does not need to be Nullable but it can crash otherwise, probably caused by replacing items while looping over them.
|
||||
// "Attempt to invoke .... getHash() on a null object reference"
|
||||
private val cache: ArrayList<SavedLoadResponse?> = arrayListOf()
|
||||
private var cacheIndex: Int = 0
|
||||
const val cacheSize = 20
|
||||
}
|
||||
|
@ -60,7 +61,7 @@ class APIRepository(val api: MainAPI) {
|
|||
|
||||
for (item in cache) {
|
||||
// 10 min save
|
||||
if (item.hash == lookingForHash && (unixTime - item.unixTime) < 60 * 10) {
|
||||
if (item?.hash == lookingForHash && (unixTime - item.unixTime) < 60 * 10) {
|
||||
return@safeApiCall item.response
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue