Skip to content

fix: nullPointerException in GroupView when drawing bitmap on Android 10 and older #2694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

OmalPerera
Copy link

@OmalPerera OmalPerera commented May 27, 2025

Summary

Open Issue: isRecycled() on a null object reference

This PR addresses a sporadic crash that occurs specifically on Android 10 (API 29) and older when rendering SVGs.

  • Although the code already handles the mLayerBitmap being null in an earlier section, the bitmap can still become null on Android 10 and below due to memory pressure or race conditions, ultimately leading to a crash.

  • Differences in how Bitmap memory handled and Canvas drawing operations are handled in these versions, make them more susceptible to this issue.)
    Reference: Android Bitmap Memory Management

Test Plan

Unfortunately, it is bit hard to recreate this behaviour and it is very sporadic.
I have patched this change in my app, and it has produced positive results. both for me and for some other users as well.
(#2609 (comment))

What's required for testing (prerequisites)?

What are the steps to reproduce (after prerequisites)?

Compatibility

OS Implemented
iOS
MacOS
Android
Web

Checklist

  • I have tested this on a device and a simulator
  • I added documentation in README.md
  • I updated the typed files (typescript)
  • I added a test for the API in the __tests__ folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant