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 (
15
15
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
16
16
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
17
17
"github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/client"
18
+ "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
18
19
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
19
20
)
20
21
@@ -66,7 +67,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
66
67
if err != nil {
67
68
return fmt .Errorf ("list public IP ranges: %w" , err )
68
69
}
69
- publicIpRanges := * resp .Items
70
+ publicIpRanges := utils . GetSliceFromPointer ( resp .Items )
70
71
71
72
// Truncate output
72
73
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
250
250
251
251
return result
252
252
}
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