fix: Fix NullPointerException
in initFrameProcessorPlugin
if plugin is not found (#2454)
* fix: fix the null exception * Add `Nullable` and `NonNull` annotations --------- Co-authored-by: Marc Rousavy <me@mrousavy.com>
This commit is contained in:
parent
d9a301100f
commit
02bc8a979c
@ -36,7 +36,7 @@ public class FrameProcessorPluginRegistry {
|
||||
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
public static FrameProcessorPlugin getPlugin(String name, VisionCameraProxy proxy, Map<String, Object> options) {
|
||||
public static @Nullable FrameProcessorPlugin getPlugin(String name, VisionCameraProxy proxy, Map<String, Object> options) {
|
||||
Log.i(TAG, "Looking up Frame Processor Plugin \"" + name + "\"...");
|
||||
PluginInitializer initializer = Plugins.get(name);
|
||||
if (initializer == null) {
|
||||
@ -48,6 +48,6 @@ public class FrameProcessorPluginRegistry {
|
||||
}
|
||||
|
||||
public interface PluginInitializer {
|
||||
FrameProcessorPlugin initializePlugin(@NonNull VisionCameraProxy proxy, @Nullable Map<String, Object> options);
|
||||
@NonNull FrameProcessorPlugin initializePlugin(@NonNull VisionCameraProxy proxy, @Nullable Map<String, Object> options);
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ class VisionCameraProxy(context: ReactApplicationContext) {
|
||||
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
fun initFrameProcessorPlugin(name: String, options: Map<String, Any>): FrameProcessorPlugin =
|
||||
fun initFrameProcessorPlugin(name: String, options: Map<String, Any>): FrameProcessorPlugin? =
|
||||
FrameProcessorPluginRegistry.getPlugin(name, this, options)
|
||||
|
||||
// private C++ funcs
|
||||
|
Loading…
Reference in New Issue
Block a user