!6174 fix:修复mac地址为空导致的异常

Merge pull request !6174 from 伍瑞/master
This commit is contained in:
openharmony_ci 2024-05-21 07:09:16 +00:00 committed by Gitee
commit 31c0a96299
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -380,6 +380,10 @@ int32_t P2pAdapter::GetDynamicMacAddress(std::string &macString)
int32_t P2pAdapter::RequestGcIp(const std::string &macString, std::string &ipString)
{
if (macString.size() == 0) {
CONN_LOGE(CONN_WIFI_DIRECT, "mac is empty");
return SOFTBUS_INVALID_PARAM;
}
std::vector<uint8_t> macArray = WifiDirectUtils::MacStringToArray(macString);
uint32_t ipArray[IPV4_ADDR_ARRAY_LEN];