Skip to content

Commit 6b5e775

Browse files
committed
fix(facedetection): only set instance if supported
1 parent d8ba3b4 commit 6b5e775

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: packages/mlkit-core/index.android.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ export class MLKitView extends MLKitViewBase {
251251
}
252252

253253
if (!this.#onFaceListener && (this.detectionType === DetectionType.Face || this.detectionType === DetectionType.All)) {
254-
this.#faceDetectionOptions = new io.github.triniwiz.fancycamera.facedetection.FaceDetection.Options();
254+
if (FACE_DETECTION_SUPPORTED()) {
255+
this.#faceDetectionOptions = new io.github.triniwiz.fancycamera.facedetection.FaceDetection.Options();
256+
}
255257
this.#onFaceListener = new io.github.triniwiz.fancycamera.ImageAnalysisCallback({
256258
onSuccess(param0: string) {
257259
const hasListener = ref?.get?.().hasListeners?.(MLKitView.detectionEvent);

0 commit comments

Comments
 (0)