question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImageAssetManager will casue crash when decode asset throw IOException

See original GitHub issue

Littie 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:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
gpealcommented, Jan 5, 2021

@1wayticket reopening to track this.

0reactions
1wayticketcommented, Jan 21, 2021

@gpeal Allright~

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found