diff options
Diffstat (limited to 'src/mapport.cpp')
-rw-r--r-- | src/mapport.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mapport.cpp b/src/mapport.cpp index 76f8a4d0c9..118827901a 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<CNetAddr> 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"); |