diff --git a/ipc/native/src/core/source/ipc_process_skeleton.cpp b/ipc/native/src/core/source/ipc_process_skeleton.cpp index 123d19158dcf957454ef78a6ad497b5040685c9f..8a39fdcb07a5fa4152e3c1b05deaee33ce68e24c 100644 --- a/ipc/native/src/core/source/ipc_process_skeleton.cpp +++ b/ipc/native/src/core/source/ipc_process_skeleton.cpp @@ -284,9 +284,7 @@ bool IPCProcessSkeleton::AttachObject(IRemoteObject *object) return false; } std::u16string descriptor = object->GetObjectDescriptor(); - if (descriptor.empty()) { - return false; - } + auto current = ProcessSkeleton::GetInstance(); if (current == nullptr) { ZLOGE(LOG_LABEL, "get process skeleton failed"); diff --git a/ipc/native/src/core/source/process_skeleton.cpp b/ipc/native/src/core/source/process_skeleton.cpp index b5a072ce5d1e32fccbede9c6017d207d6161c9c2..47325ffb7615e2f4bd9b5c903f27525dac879c1b 100644 --- a/ipc/native/src/core/source/process_skeleton.cpp +++ b/ipc/native/src/core/source/process_skeleton.cpp @@ -101,6 +101,9 @@ bool ProcessSkeleton::AttachObject(IRemoteObject *object, const std::u16string & std::unique_lock lockGuard(objMutex_); (void)isContainStub_.insert(std::pair(object, true)); + if (descriptor.empty()) { + return false; + } // If attemptIncStrong failed, old proxy might still exist, replace it with the new proxy. wptr wp = object; auto result = objects_.insert_or_assign(descriptor, wp);