mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-12 08:58:51 -04:00
Fixed: Application crashes when loading the asset(videos) from cache.
* The getData method of the Item class was throwing an error due to any condition, the reason is unknown(may be the data is corrupted or anything) since there are only very less occurrences but it was crashing the application so we are catching the exception if thrown by the `getData()` method so that our application will not crash.
This commit is contained in:
parent
9c69d77739
commit
ca6d37b43f
@ -347,7 +347,12 @@ class ZimFileReader constructor(
|
||||
.inputStream()
|
||||
}
|
||||
|
||||
private fun getContent(url: String) = getItem(url)?.data?.data
|
||||
private fun getContent(url: String) = try {
|
||||
getItem(url)?.data?.data
|
||||
} catch (ignore: Exception) {
|
||||
Log.e(TAG, "Could not get content for url = $url original exception = $ignore")
|
||||
null
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun streamZimContentToPipe(item: Item?, uri: String, outputStream: OutputStream) {
|
||||
@ -365,8 +370,8 @@ class ZimFileReader constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ioException: IOException) {
|
||||
Log.e(TAG, "error writing pipe for $uri", ioException)
|
||||
} catch (ignore: Exception) {
|
||||
Log.e(TAG, "error writing pipe for $uri", ignore)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user