ImageAssetManager will casue crash when decode asset throw IOException
See original GitHub issueLittie v3.1.0 I have met some crash logs about Lottie recently. When I read the source code ,I find there maybe a bug. Class:com.airbnb.lottie.manager.ImageAssetManager
InputStream is;
try {
if (TextUtils.isEmpty(imagesFolder)) {
throw new IllegalStateException("You must set an images folder before loading an image." +
" Set it with LottieComposition#setImagesFolder or LottieDrawable#setImagesFolder");
}
is = context.getAssets().open(imagesFolder + filename);
} catch (IOException e) {
Logger.warning("Unable to open asset.", e);
return null;
}
bitmap = BitmapFactory.decodeStream(is, null, opts);
bitmap = Utils.resizeBitmapIfNeeded(bitmap, asset.getWidth(), asset.getHeight());
When AssetManager open file throw IOException,this is is null,and this bitmap will be null.and Utils.resizeBitmapIfNeeded will throw NPE. I find the newest version alse has the problem, so please recheck these code,thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top Results From Across the Web
IOException when reading AssetFileDescriptor - Stack Overflow
The problem was that I wasn't reading the asset from the main thread. ... an IOException would be thrown with "lseek failed: EBADF...
Read more >AssetManager - Android Developers
Provides access to an application's raw asset files; see Resources for the way most applications will want to retrieve their resource data.
Read more >Asset Manager crashes when clicking "Asset Preview"
To reproduce, simply right click on some image assets and click “Asset Preview”. After a handful of tries, the asset manager should crash....
Read more >What is new in Android P — ImageDecoder ... - Medium
ImageDecoder.createSource(assetManager, assetFileName). Next, the source object can be decoded into drawable or bitmap: // create bitmap
Read more >'bitmap size exceeds VM budget' if Activity is restarted ...
“ ees oslAissue 36921139 for a test case that should trigger the bug every time. ... images is a String[] array of file...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@1wayticket reopening to track this.
@gpeal Allright~