leg100 / pug

Drive terraform at terminal velocity.
Mozilla Public License 2.0
439 stars 7 forks source link

Pressing enter on a state resources causes a panic #97

Closed leg100 closed 2 months ago

leg100 commented 2 months ago

Describe the bug Pressing enter on a state resource causes a panic

To Reproduce Steps to reproduce the behavior:

  1. Go to a module with some state
  2. Click s
  3. Press <enter> on a state resource
  4. See error:
Caught panic:

runtime error: invalid memory address or nil pointer dereference

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
    /usr/lib/go/src/runtime/debug/stack.go:24 +0x5e
runtime/debug.PrintStack()
    /usr/lib/go/src/runtime/debug/stack.go:16 +0x13
github.com/charmbracelet/bubbletea.(*Program).Run.func1()
    /home/louis/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.26.2/tea.go:479 +0x91
panic({0x8df820?, 0xdd9bb0?})
    /usr/lib/go/src/runtime/panic.go:770 +0x132
github.com/leg100/pug/internal/tui/workspace.(*ResourceMaker).Make(0xc00026aab0, {0xc00026aa80?, 0x7?}, 0xff, 0x3d)
    /home/louis/co/pug/internal/tui/workspace/resource.go:25 +0x44
github.com/leg100/pug/internal/tui/top.(*navigator).setCurrent(0xc000259300, {0xa7ad20?, {0xc00007eb18?, 0xc000a741a8?}})
    /home/louis/co/pug/internal/tui/top/navigator.go:63 +0x102
github.com/leg100/pug/internal/tui/top.model.Update({0xc000259300, {0xa81bf0, 0xc000266e00}, 0xff, 0x3f, 0x0, 0x0, 0x0, 0xc00007eb18, {0xc0002686b8, ...}, ...}, ...)
    /home/louis/co/pug/internal/tui/top/model.go:255 +0x13b8
github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc000274410, {0xa7e040?, 0xc000260aa0?}, 0xc000030960)
    /home/louis/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.26.2/tea.go:412 +0x662
github.com/charmbracelet/bubbletea.(*Program).Run(0xc000274410)
    /home/louis/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.26.2/tea.go:547 +0x89f
github.com/leg100/pug/internal/app.Start({0xa7ad20, 0xc00007e028}, {0xa7ad20?, 0xc00007e030?}, {0xc0000241f0?, 0xc000030178?, 0xd22078?})
    /home/louis/co/pug/internal/app/app.go:70 +0x3ca
main.main()
    /home/louis/co/pug/main.go:11 +0x6d

Expected behavior See state resource in full screen.

Additional context

https://github.com/leg100/pug/issues/96