mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-04-21 20:12:33 +03:00
fix handling if no IP could be detected
The current code for no public IP-Address ends with a panic because the error is passed through even it got handled. This commit corrects this.
This commit is contained in:
parent
f256668a99
commit
7d9538f250
1 changed files with 4 additions and 2 deletions
|
@ -221,10 +221,12 @@ func GetPublicIP() (model.Interface, error) {
|
|||
ip, err := consensus.ExternalIP()
|
||||
if err != nil {
|
||||
publicInterface.IPAddress = "N/A"
|
||||
} else {
|
||||
publicInterface.IPAddress = ip.String()
|
||||
}
|
||||
publicInterface.IPAddress = ip.String()
|
||||
|
||||
return publicInterface, err
|
||||
// error handling happend above, no need to pass it through
|
||||
return publicInterface, nil
|
||||
}
|
||||
|
||||
// GetIPFromCIDR get ip from CIDR
|
||||
|
|
Loading…
Add table
Reference in a new issue