Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa70f221 authored by Jesse Hall's avatar Jesse Hall
Browse files

Restore a mistakenly-removed null check

Passing null to camera.setPreviewDisplay() needs to work; this
restores the behavior from before the Surface/SurfaceControl
refactoring.

Bug: 8225538
Change-Id: Ib73bfa9fe53457a41a69b7fe5dfff3a3aa260f52
parent e9655887
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -537,7 +537,10 @@ static void android_hardware_Camera_setPreviewDisplay(JNIEnv *env, jobject thiz,
    sp<Camera> camera = get_native_camera(env, thiz, NULL);
    if (camera == 0) return;

    sp<Surface> surface = android_view_Surface_getSurface(env, jSurface);
    sp<Surface> surface;
    if (jSurface) {
        surface = android_view_Surface_getSurface(env, jSurface);
    }

    if (camera->setPreviewDisplay(surface) != NO_ERROR) {
        jniThrowException(env, "java/io/IOException", "setPreviewDisplay failed");