Skip to content
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

fix: Fix NullPointerException in initFrameProcessorPlugin if plugin is not found #2454

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

vanenshi
Copy link
Contributor

What

If you call the VisionCameraProxy.initFrameProcessorPlugin('processor'); and the specific processor were not available, the whole program crash with this error

JNI DETECTED ERROR IN APPLICATION: JNI GetObjectRefType called with pending exception java.lang.NullPointerException: getPlugin(name, this, options) must not be null

this fix mark the getPlugin function as nullable

Changes

mark the getPlugin function as nullable

Tested on

Android simulator, and real android device

Copy link

vercel bot commented Jan 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-vision-camera ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 29, 2024 7:08pm

@vanenshi vanenshi changed the title fix: fix the null exception Fix NullPointerException on getPlugin in Android Jan 29, 2024
@vanenshi vanenshi changed the title Fix NullPointerException on getPlugin in Android [Android] Fix NullPointerException on getPlugin Jan 29, 2024
@mrousavy mrousavy changed the title [Android] Fix NullPointerException on getPlugin fix: Fix NullPointerException in initFrameProcessorPlugin if plugin is not found Jan 29, 2024
@mrousavy
Copy link
Owner

Hey, thank you for your contribution!! This is perfect, nice catch.

I just added two annotations to make this even clearer (with those I would've caught the mistake as bridging Java -> Kotlin requires such annotations, otherwise non-null is assumed)

Once the CI goes green we can merge 🚀

@mrousavy mrousavy merged commit 02bc8a9 into mrousavy:main Jan 30, 2024
5 checks passed
@mrousavy
Copy link
Owner

merged! 🚀

@vanenshi vanenshi deleted the patch-1 branch January 30, 2024 11:14
isaaccolson pushed a commit to isaaccolson/deliveries-mobile that referenced this pull request Oct 30, 2024
…in is not found (mrousavy#2454)

* fix: fix the null exception

* Add `Nullable` and `NonNull` annotations

---------

Co-authored-by: Marc Rousavy <me@mrousavy.com>
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.

2 participants