fix: Fix not-found plugins crashing the app #3076
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
The
VisionCameraProxy.initFrameProcessorPlugin
function returnsundefined
if a plugin cannot be found.On iOS, this worked. On Android however, I internally (in C++) didn't check for
nullptr
, so I always tried to create a callable plugin (FrameProcessorPluginHostObject
) with anullptr
implementation.If the plugin was not found, it would crash the app with a very cryptic error:
..which in hindsight is obvious; the
_plugin
wasnullptr
(not found), but I still tried to access data on it.This error also lead to this error later on in the
adb logcat
logs:(and a lot of people only read the last error, they didn't read the one before that (
JNI DETECTED ERROR IN APPLICATION: java_object == null
) so it was very confusing)This PR now prevents this issue by returning
undefined
if a plugin cannot be found.Changes
Tested on
Related issues