- Notifications
You must be signed in to change notification settings - Fork1.1k
Commit212aeff
authored
fix(cli): fix potential panic in traceError if unwrapped err is nil (#15166)
Seen while investigating#12721:Root cause was a developer error, but this definitely shouldn't panic.Before:```/ # coder statpanic: runtime error: invalid memory address or nil pointer dereference[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1f12eb0]goroutine 1 [running]:github.com/coder/coder/v2/cli.traceError({0x90e89a0?, 0x40007a8210}) /home/runner/work/coder/coder/cli/root.go:1119 +0x70github.com/coder/coder/v2/cli.cliHumanFormatError({0x40003065a0, 0x1c8}, {0x90e89a0, 0x40007a8210}, 0x40007a81e0?) /home/runner/work/coder/coder/cli/root.go:985 +0x190github.com/coder/coder/v2/cli.cliHumanFormatError({0x40000d0f00, 0x139}, {0x90e89a0, 0x40007a81e0}, 0x40001c4480?) /home/runner/work/coder/coder/cli/root.go:985 +0x1d8github.com/coder/coder/v2/cli.cliHumanFormatError({0x40000d0b40, 0xf}, {0x90e5f00, 0x40006a3a80}, 0x90e5d40?) /home/runner/work/coder/coder/cli/root.go:985 +0x1d8github.com/coder/coder/v2/cli.cliHumanFormatError({0x0, 0x0}, {0x90e5ce0, 0x40003b14c0}, 0x2?) /home/runner/work/coder/coder/cli/root.go:985 +0x1d8github.com/coder/coder/v2/cli.formatRunCommandError(0x40007a8108, 0x400079fce7) /home/runner/work/coder/coder/cli/root.go:1057 +0x30cgithub.com/coder/coder/v2/cli.cliHumanFormatError({0x0, 0x0}, {0x90e5ec0, 0x40007a8108}, 0xaa0aed0?) /home/runner/work/coder/coder/cli/root.go:980 +0xe0github.com/coder/coder/v2/cli.cliHumanFormatError({0x0, 0x0}, {0x90e5160, 0x40007a8120}, 0x90e50e0?) /home/runner/work/coder/coder/cli/root.go:966 +0x144github.com/coder/coder/v2/cli.(*PrettyErrorFormatter).Format(0x400079fda0, {0x90e5160?, 0x40007a8120?}) /home/runner/work/coder/coder/cli/root.go:927 +0x48github.com/coder/coder/v2/cli.(*RootCmd).RunWithSubcommands(0x400068ed80, {0x400053a2c8, 0x30, 0x57}) /home/runner/work/coder/coder/cli/root.go:175 +0x278main.main() /home/runner/work/coder/coder/enterprise/cmd/coder/main.go:11 +0x40```After:```Encountered an error running "coder stat", see "coder stat --help" for more informationerror: <nil>```1 parent23f61c6 commit212aeff
1 file changed
+10
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1116 | 1116 | | |
1117 | 1117 | | |
1118 | 1118 | | |
1119 | | - | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
1120 | 1129 | | |
1121 | 1130 | | |
1122 | 1131 | | |
| |||
0 commit comments
Comments
(0)