mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix for ImageResizer crashing the application when a broken image is retrieved... (#72)
This commit is contained in:
committed by
Hristo Hristov
parent
37491faa4c
commit
053e3071b7
@@ -147,7 +147,18 @@ public abstract class Resizer extends Worker {
|
||||
addInBitmapOptions(options, cache);
|
||||
}
|
||||
|
||||
return BitmapFactory.decodeFileDescriptor(fileDescriptor, null, options);
|
||||
Bitmap results = null;
|
||||
try {
|
||||
// This can throw an error on a corrupted image when using an inBitmap
|
||||
results = BitmapFactory.decodeFileDescriptor(fileDescriptor, null, options);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// clear the inBitmap and try again
|
||||
options.inBitmap = null;
|
||||
results = BitmapFactory.decodeFileDescriptor(fileDescriptor, null, options);
|
||||
// If image is broken, rather than an issue with the inBitmap, we will get a NULL out in this case...
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public static Bitmap decodeSampledBitmapFromByteArray(
|
||||
|
||||
Reference in New Issue
Block a user