hetznercloud / cli

A command-line interface for Hetzner Cloud
MIT License
1.09k stars 79 forks source link

`hcloud image list`: segmentation violation when `created_from` column is included in the output #384

Closed tagirb closed 2 years ago

tagirb commented 2 years ago

Here's the way to reproduce the error:

$ hcloud image list -t snapshot -o columns=id,name,type,created
ID         NAME   TYPE       CREATED
x           -      snapshot   Wed Dec  8 11:21:41 CET 2021
x           -      snapshot   Wed Dec  8 11:25:38 CET 2021
x           -      snapshot   Wed Jan 12 14:09:26 CET 2022
x           -      snapshot   Tue Jan 18 21:14:11 CET 2022
x           -      snapshot   Mon Jan 24 16:09:35 CET 2022
x           -      snapshot   Tue Feb  8 12:43:01 CET 2022
x           -      snapshot   Tue Feb  8 12:48:02 CET 2022

$ hcloud image list -t snapshot -o columns=id,name,type,created_from
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x56430386c05e]

goroutine 1 [running]:
github.com/hetznercloud/cli/internal/cmd/image.glob..func13.6({0x5643039f45e0, 0xc0003ee000})
    github.com/hetznercloud/cli/internal/cmd/image/list.go:82 +0x5e
github.com/hetznercloud/cli/internal/cmd/output.(*Table).Write(0xc000382ed0, {0xc000037800, 0x4, 0x8}, {0x5643039f45e0, 0xc0003ee000})
    github.com/hetznercloud/cli/internal/cmd/output/output.go:277 +0x35d
github.com/hetznercloud/cli/internal/cmd/base.(*ListCmd).Run(0x564303df8d40, {0x564303aa1290, 0xc0000be000}, {0x564303aae4b8, 0xc000192a20}, 0x0)
    github.com/hetznercloud/cli/internal/cmd/base/list.go:82 +0x35f
github.com/hetznercloud/cli/internal/cmd/base.(*ListCmd).CobraCommand.func1(0xc0001ddb80, {0xc000037780, 0x0, 0x4})
    github.com/hetznercloud/cli/internal/cmd/base/list.go:42 +0x33
github.com/spf13/cobra.(*Command).execute(0xc0001ddb80, {0xc0000ba030, 0x4, 0x4})
    github.com/spf13/cobra@v1.1.3/command.go:852 +0x60e
github.com/spf13/cobra.(*Command).ExecuteC(0xc00019cf00)
    github.com/spf13/cobra@v1.1.3/command.go:960 +0x3ad
github.com/spf13/cobra.(*Command).Execute(...)
    github.com/spf13/cobra@v1.1.3/command.go:897
main.main()
    github.com/hetznercloud/cli/cmd/hcloud/main.go:38 +0x1fe
4ND3R50N commented 2 years ago

Thank you for reporting 👍

As you can see, the bug should be fixed now!

Dont hesitate to contact us again, if you encounter any problems! :-)

tagirb commented 2 years ago

Awesome, thanks for the prompt fix! :)