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

Commit f176757e authored by Yunlian Jiang's avatar Yunlian Jiang Committed by android-build-merger
Browse files

Merge "fix Access to field 'targets' results in a dereference of a null pointer" am: caea9fc2

am: 52caf00e

Change-Id: I15f70bc8db093c14a499ef0e53abb4e62a5629ce
parents 2943f747 52caf00e
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -51,8 +51,13 @@ camera_status_t ACaptureRequest_addTarget(
        ACaptureRequest* req, const ACameraOutputTarget* target) {
    ATRACE_CALL();
    if (req == nullptr || req->targets == nullptr || target == nullptr) {
        void* req_targets;
        if (req != nullptr)
            req_targets = req->targets;
        else
            req_targets = nullptr;
        ALOGE("%s: Error: invalid input: req %p, req-targets %p, target %p",
                __FUNCTION__, req, req->targets, target);
                __FUNCTION__, req, req_targets, target);
        return ACAMERA_ERROR_INVALID_PARAMETER;
    }
    auto pair = req->targets->mOutputs.insert(*target);
@@ -67,8 +72,13 @@ camera_status_t ACaptureRequest_removeTarget(
        ACaptureRequest* req, const ACameraOutputTarget* target) {
    ATRACE_CALL();
    if (req == nullptr || req->targets == nullptr || target == nullptr) {
        void* req_targets;
        if (req != nullptr)
            req_targets = req->targets;
        else
            req_targets = nullptr;
        ALOGE("%s: Error: invalid input: req %p, req-targets %p, target %p",
                __FUNCTION__, req, req->targets, target);
                __FUNCTION__, req, req_targets, target);
        return ACAMERA_ERROR_INVALID_PARAMETER;
    }
    req->targets->mOutputs.erase(*target);