Skip to content

Android Crash: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference #188

Open
@ponikar

Description

@ponikar

Before submitting a new issue

  • I tested using the latest version of the library, as the bug might be already fixed.
  • I tested using a supported version of react native.
  • I checked for possible duplicate issues, with possible answers.

Bug summary

I was checking sentry logs and came across this crash. This is crash is not reproducible all the time. I don't have more information but sentry has captured some logs that might help.

NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference

java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
    at com.horcrux.svg.FilterUtils.getBitmapWithColorMatrix(FilterUtils.java:14)
    at com.horcrux.svg.FilterUtils.applySourceAlphaFilter(FilterUtils.java:35)
    at com.horcrux.svg.FilterView.applyFilter(FilterView.java:77)
    at com.horcrux.svg.RenderableView.render(RenderableView.java:400)
    at com.horcrux.svg.GroupView.drawGroup(GroupView.java:132)
    at com.horcrux.svg.GroupView.draw(GroupView.java:88)
    at com.horcrux.svg.RenderableView.render(RenderableView.java:490)
    at com.horcrux.svg.SvgView.drawChildren(SvgView.java:336)
    at com.horcrux.svg.GroupView.drawGroup(GroupView.java:155)
    at com.horcrux.svg.GroupView.draw(GroupView.java:88)
    at com.horcrux.svg.RenderableView.render(RenderableView.java:490)
    at com.horcrux.svg.SvgView.drawChildren(SvgView.java:336)
    at com.horcrux.svg.SvgView.drawOutput(SvgView.java:282)

Library version

2.0.1

Environment info

System:
OS: macOS 15.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 113.31 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.19.0
path: ~/.nvm/versions/node/v20.19.0/bin/node
Yarn:
version: 1.22.22
path: /usr/local/bin/yarn
npm:
version: 10.8.2
path: ~/.nvm/versions/node/v20.19.0/bin/npm
Watchman:
version: 2025.03.10.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /opt/homebrew/lib/ruby/gems/3.1.0/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.0
- iOS 18.0
- macOS 15.0
- tvOS 18.0
- visionOS 2.0
- watchOS 11.0
Android SDK: Not Found
IDEs:
Android Studio: 2024.2 AI-242.23726.103.2422.12816248
Xcode:
version: 16.0/16A242d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.11
path: /usr/bin/javac
Ruby:
version: 3.1.5
path: /opt/homebrew/opt/ruby@3.1/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found

Steps to reproduce

Sorry but this is not reproducible all the time and happened randomly with one our users.

Reproducible example repository

Sorry but this is not reproducible all the time and happened randomly with one our users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions