vultr / vultr-cli

Official command line tool for Vultr services
Apache License 2.0
469 stars 75 forks source link

[BUG] - Listing region availabilities causes a panic #408

Closed PaulSonOfLars closed 6 months ago

PaulSonOfLars commented 6 months ago

Describe the bug Listing region availability panics when using the default text output. Available plans are listed, but finishes with an error.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1466972]

goroutine 1 [running]:
github.com/vultr/vultr-cli/v3/cmd/regions.(*RegionsAvailabilityPrinter).Paging(0xc000212950?)
    github.com/vultr/vultr-cli/v3/cmd/regions/printer.go:110 +0x12
github.com/vultr/vultr-cli/v3/cmd/printer.(*Output).Display(0xc0000976b0, {0x1649540, 0xc000212950}, {0x0?, 0x0?})
    github.com/vultr/vultr-cli/v3/cmd/printer/printer.go:80 +0x162
github.com/vultr/vultr-cli/v3/cmd/regions.NewCmdRegion.func4(0xc0001e0100?, {0xc000212150?, 0x4?, 0x156a19c?})
    github.com/vultr/vultr-cli/v3/cmd/regions/regions.go:110 +0xc7
github.com/spf13/cobra.(*Command).execute(0xc0001de900, {0xc000212120, 0x1, 0x1})
    github.com/spf13/cobra@v1.8.0/command.go:983 +0xabc
github.com/spf13/cobra.(*Command).ExecuteC(0x194f660)
    github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
    github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/vultr/vultr-cli/v3/cmd.Execute()
    github.com/vultr/vultr-cli/v3/cmd/root.go:62 +0x1a
main.main()
    github.com/vultr/vultr-cli/v3/main.go:7 +0xf

To Reproduce Steps to reproduce the behavior:

  1. vultr-cli regions availability ams
  2. Availabilities are listed, but a panic occurs.

Expected behavior No panic.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information where applicable:

Additional context

The issue seems to be called by a nil Meta field on this line. Happy to open a PR to patch this if the project is open to external contributions.

optik-aper commented 6 months ago

@PaulSonOfLars Thanks for the due diligence. I'll get it fixed ASAP and out in the next release this week.