From 05d534cf7c76b8174ae4b0a14d69aacda592231b Mon Sep 17 00:00:00 2001 From: Denis Zheleztsov Date: Wed, 13 Nov 2024 14:06:53 +0300 Subject: [PATCH] Check for nil opts.Network/*Server to prevent panic in *ServerClient.ChangeAliasIPs --- hcloud/server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hcloud/server.go b/hcloud/server.go index d1514f5c..b2a4d10c 100644 --- a/hcloud/server.go +++ b/hcloud/server.go @@ -1055,6 +1055,10 @@ type ServerChangeAliasIPsOpts struct { // ChangeAliasIPs changes a server's alias IPs in a network. func (c *ServerClient) ChangeAliasIPs(ctx context.Context, server *Server, opts ServerChangeAliasIPsOpts) (*Action, *Response, error) { + if opts.Network == nil || server == nil { + return nil, nil, fmt.Errorf("*opts.Network/*Server cannot be nil") + } + reqBody := schema.ServerActionChangeAliasIPsRequest{ Network: opts.Network.ID, AliasIPs: []string{},