diff --git a/frameworks/inner/ipc/src/bluetooth_host_proxy.cpp b/frameworks/inner/ipc/src/bluetooth_host_proxy.cpp index 64a127128b939e54dbe969a67894e9ddcdd2ce4e..c7fee8a7ad20a9a9a30aae616b76222b6cf53b2a 100644 --- a/frameworks/inner/ipc/src/bluetooth_host_proxy.cpp +++ b/frameworks/inner/ipc/src/bluetooth_host_proxy.cpp @@ -1553,8 +1553,11 @@ int32_t BluetoothHostProxy::GetRandomAddress(const std::string &realAddr, std::s HILOGE("BluetoothHostProxy::GetRandomAddress fail, error: %{public}d", error); return BT_ERR_IPC_TRANS_FAILED; } - randomAddr = reply.ReadString(); - return reply.ReadInt32(); + int32_t exception = reply.ReadInt32(); + if (exception == BT_NO_ERROR) { + randomAddr = reply.ReadString(); + } + return exception; } int32_t BluetoothHostProxy::SyncRandomAddress(const std::string &realAddr, const std::string &randomAddr)