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

Commit 8a004a42 authored by Yifan Hong's avatar Yifan Hong Committed by android-build-merger
Browse files

Merge "Check for nullptr when casting IBinder to IBase." am: 50140286 am:...

Merge "Check for nullptr when casting IBinder to IBase." am: 50140286 am: 1abe6def am: fee17700
am: be1ea967

Change-Id: I9966f11aed18d4247e24b3ed0a1716096efe01e2
parents e9b8dbd5 be1ea967
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -241,7 +241,14 @@ static void JHwBinder_native_registerService(
    using android::hidl::manager::V1_0::IServiceManager;

    sp<hardware::IBinder> binder = JHwBinder::GetNativeContext(env, thiz);

    sp<hidl::base::V1_0::IBase> base = hidl::base::V1_0::IHwBase::asInterface(binder);
    if (base.get() == nullptr) {
        LOG(ERROR) << "IBinder object cannot be casted to the base interface.";
        signalExceptionForError(env, UNKNOWN_ERROR);
        return;
    }

    bool ok = hardware::defaultServiceManager()->add(
                interfaceChain,
                serviceName,