From 5c832c3820253affc65c0ed490e26e5b0a4d5c9b Mon Sep 17 00:00:00 2001 From: brunoerg Date: Tue, 11 Oct 2022 13:37:45 -0300 Subject: p2p, refactor: return `std::optional` in `LookupHost` --- src/mapport.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mapport.cpp') diff --git a/src/mapport.cpp b/src/mapport.cpp index 994fd12cf5..2bcd169e92 100644 --- a/src/mapport.cpp +++ b/src/mapport.cpp @@ -175,10 +175,10 @@ static bool ProcessUpnp() LogPrintf("UPnP: GetExternalIPAddress() returned %d\n", r); } else { if (externalIPAddress[0]) { - CNetAddr resolved; - if (LookupHost(externalIPAddress, resolved, false)) { - LogPrintf("UPnP: ExternalIPAddress = %s\n", resolved.ToStringAddr()); - AddLocal(resolved, LOCAL_MAPPED); + std::optional resolved{LookupHost(externalIPAddress, false)}; + if (resolved.has_value()) { + LogPrintf("UPnP: ExternalIPAddress = %s\n", resolved->ToStringAddr()); + AddLocal(resolved.value(), LOCAL_MAPPED); } } else { LogPrintf("UPnP: GetExternalIPAddress failed.\n"); -- cgit v1.2.3