(#17191) ipaddress returns localhost instead of error

If the local interface is the only one with an IP, then ipaddress will
not be returned without this patch.