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

Commit 785294e3 authored by Sungtak Lee's avatar Sungtak Lee
Browse files

media.c2 aidl: Check mListener is not null for Component

Bug: 321902635
Change-Id: I63b8e9807e0225e82f5f7e58fca4d537653ccc06
parent 777bfbea
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -53,6 +53,8 @@ struct Component::Listener : public C2Component::Listener {
    Listener(const std::shared_ptr<Component>& component) :
            mComponent(component),
            mListener(component->mListener) {
        CHECK(component);
        CHECK(component->mListener);
    }

    virtual void onError_nb(
@@ -420,6 +422,8 @@ void Component::initListener(const std::shared_ptr<Component>& self) {
            mInit = res;
        }

        // b/321902635, mListener should not be null.
        CHECK(mListener);
        mDeathRecipient = ::ndk::ScopedAIBinder_DeathRecipient(
                AIBinder_DeathRecipient_new(OnBinderDied));
        mDeathContext = new DeathContext{ref<Component>()};
+4 −1
Original line number Diff line number Diff line
@@ -210,6 +210,8 @@ ScopedAStatus ComponentStore::createComponent(
    c2_status_t status =
            mStore->createComponent(name, &c2component);

    ALOGD("createComponent(): listener(%d)", bool(listener));

    if (status == C2_OK) {
#ifndef __ANDROID_APEX__
        c2component = GetFilterWrapper()->maybeWrapComponent(c2component);
@@ -218,7 +220,8 @@ ScopedAStatus ComponentStore::createComponent(
        std::shared_ptr<Component> comp =
            SharedRefBase::make<Component>(c2component, listener, ref<ComponentStore>(), pool);
        *component = comp;
        if (!component) {
        if (!component || !comp) {
            ALOGE("createComponent(): component cannot be returned");
            status = C2_CORRUPTED;
        } else {
            reportComponentBirth(comp.get());