[adb] Check for null in mdns connect info.
Adb client does not use these values, so just ignore it. Bug: b/158824677 Test: 'adb -H 127.0.0.1 -P 5037 devices' does not crash. Change-Id: I4dada6e5e1714157bbf1af370510dfa7bfbd6b17
This commit is contained in:
parent
f9033832cf
commit
282385f823
|
@ -680,6 +680,13 @@ std::string mdns_list_discovered_services() {
|
|||
std::optional<MdnsInfo> mdns_get_connect_service_info(std::string_view name) {
|
||||
CHECK(!name.empty());
|
||||
|
||||
// only adb server creates these registries
|
||||
if (!ResolvedService::sAdbTransportServices && !ResolvedService::sAdbSecureConnectServices) {
|
||||
return std::nullopt;
|
||||
}
|
||||
CHECK(ResolvedService::sAdbTransportServices);
|
||||
CHECK(ResolvedService::sAdbSecureConnectServices);
|
||||
|
||||
auto mdns_instance = mdns::mdns_parse_instance_name(name);
|
||||
if (!mdns_instance.has_value()) {
|
||||
D("Failed to parse mDNS name [%s]", name.data());
|
||||
|
|
Loading…
Reference in New Issue