File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
cmd/public-ip/ranges/list Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import (
1515 "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1616 "github.com/stackitcloud/stackit-cli/internal/pkg/print"
1717 "github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/client"
18+ "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1819 "github.com/stackitcloud/stackit-sdk-go/services/iaas"
1920)
2021
@@ -66,7 +67,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
6667 if err != nil {
6768 return fmt .Errorf ("list public IP ranges: %w" , err )
6869 }
69- publicIpRanges := * resp .Items
70+ publicIpRanges := utils . GetSliceFromPointer ( resp .Items )
7071
7172 // Truncate output
7273 if model .Limit != nil && len (publicIpRanges ) > int (* model .Limit ) {
Original file line number Diff line number Diff line change @@ -250,3 +250,11 @@ func ConvertToBase64PatchedServers(servers []iaas.Server) []Base64PatchedServer
250250
251251 return result
252252}
253+
254+ // GetSliceFromPointer returns the value of a pointer to a slice of type T. If the pointer is nil, it returns an empty slice.
255+ func GetSliceFromPointer [T any ](s * []T ) []T {
256+ if s == nil {
257+ return []T {}
258+ }
259+ return * s
260+ }
You can’t perform that action at this time.
0 commit comments