Initialize server port in sspanel

This commit initializes the server port in sspanel.go if the userListResponse is not empty. This adds a level of preventative measure to ensure port is not left uninitialized.
This commit is contained in:
Senis John 2023-10-28 13:19:17 +08:00
parent 4d1ed21dc7
commit d9971b2181
No known key found for this signature in database
GPG Key ID: 845E9E4727C3E1A4

View File

@ -519,6 +519,11 @@ func (c *APIClient) ParseSSNodeResponse(nodeInfoResponse *NodeInfoResponse) (*ap
return nil, fmt.Errorf("unmarshal %s failed: %s", reflect.TypeOf(userListResponse), err)
}
// init server port
if len(*userListResponse) != 0 {
port = (*userListResponse)[0].Port
}
if c.SpeedLimit > 0 {
speedLimit = uint64((c.SpeedLimit * 1000000) / 8)
} else {