crashfix when opening image
This commit is contained in:
parent
90758a5ea1
commit
db6b47b351
3 changed files with 5 additions and 5 deletions
|
@ -109,7 +109,7 @@ class ImageByteStreamHandler(private val activity: Activity, private val argumen
|
|||
private fun streamImageAsIs(uri: Uri, mimeType: String) {
|
||||
try {
|
||||
StorageUtils.openInputStream(activity, uri)?.use { input -> streamBytes(input) }
|
||||
} catch (e: IOException) {
|
||||
} catch (e: Exception) {
|
||||
error("streamImage-image-read-exception", "failed to get image for mimeType=$mimeType uri=$uri", e.message)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -448,10 +448,9 @@ object StorageUtils {
|
|||
val effectiveUri = getOriginalUri(context, uri)
|
||||
return try {
|
||||
context.contentResolver.openInputStream(effectiveUri)
|
||||
} catch (e: FileNotFoundException) {
|
||||
Log.w(LOG_TAG, "failed to find file at uri=$effectiveUri")
|
||||
null
|
||||
} catch (e: SecurityException) {
|
||||
} catch (e: Exception) {
|
||||
// among various other exceptions,
|
||||
// opening a file marked pending and owned by another package throws an `IllegalStateException`
|
||||
Log.w(LOG_TAG, "failed to open file at uri=$effectiveUri", e)
|
||||
null
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ class _HomePageState extends State<HomePage> {
|
|||
final intentData = widget.intentData ?? await ViewerService.getIntentData();
|
||||
if (intentData.isNotEmpty) {
|
||||
final action = intentData['action'];
|
||||
await reportService.log('Intent action=$action');
|
||||
switch (action) {
|
||||
case 'view':
|
||||
_viewerEntry = await _initViewerEntry(
|
||||
|
|
Loading…
Reference in a new issue