Skip to content

switch: crashes when combinging --display-types and --all #5648

@kevgo

Description

@kevgo

Steps to reproduce

git-town switch --display-types --all

Command output

Caught panic:

unhandled branch type () for branch "kg-video-tools"

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
        /usr/lib/golang/src/runtime/debug/stack.go:26 +0x64
runtime/debug.PrintStack()
        /usr/lib/golang/src/runtime/debug/stack.go:18 +0x1c
github.com/charmbracelet/bubbletea.(*Program).recoverFromPanic(0x400015aa00, {0x85ec80, 0x40002be970})
        /home/kevlar/git-town/vendor/github.com/charmbracelet/bubbletea/tea.go:810 +0xa0
github.com/charmbracelet/bubbletea.(*Program).Run.func2()
        /home/kevlar/git-town/vendor/github.com/charmbracelet/bubbletea/tea.go:601 +0xdc
panic({0x85ec80?, 0x40002be970?})
        /usr/lib/golang/src/runtime/panic.go:792 +0x124
github.com/git-town/git-town/v22/internal/cli/dialog.ShouldDisplayBranchType({0x0?, 0x0?}, {0x40002cfb39, 0xe})
        /home/kevlar/git-town/internal/cli/dialog/switch_branch.go:267 +0x1f4
github.com/git-town/git-town/v22/internal/cli/dialog.SwitchModel.View({{{{0x2, {...}, {...}}, {0x2, {...}, {...}}, {0x2, {...}, {...}}, {0x2, ...}, ...}, ...}, ...})
        /home/kevlar/git-town/internal/cli/dialog/switch_branch.go:139 +0xe30
github.com/charmbracelet/bubbletea.(*Program).Run(0x400015aa00)
        /home/kevlar/git-town/vendor/github.com/charmbracelet/bubbletea/tea.go:663 +0x7bc
github.com/git-town/git-town/v22/internal/cli/dialog.SwitchBranch({{0x40002be890}, 0x2, 0x1, {0x40002de008, 0xc, 0x12}, {{0x40002a7188, 0xc, 0x12}, {0x134d660, ...}, ...}, ...})
        /home/kevlar/git-town/internal/cli/dialog/switch_branch.go:284 +0x438
github.com/git-town/git-town/v22/internal/cmd.executeSwitch({0x1, {0x400007dd80, 0x0, 0x2}, {0x134d660, 0x0, 0x0}, {0x400023a690, {0x0}, {0x0}, ...}, ...})
        /home/kevlar/git-town/internal/cmd/switch.go:126 +0x560
github.com/git-town/git-town/v22/internal/cmd.switchCmd.func1(0x4000238f08, {0x400007dd80, 0x0, 0x2})
        /home/kevlar/git-town/internal/cmd/switch.go:58 +0x2c4
github.com/spf13/cobra.(*Command).execute(0x4000238f08, {0x400007dd60, 0x2, 0x2})
        /home/kevlar/git-town/vendor/github.com/spf13/cobra/command.go:1015 +0x844
github.com/spf13/cobra.(*Command).ExecuteC(0x400021e008)
        /home/kevlar/git-town/vendor/github.com/spf13/cobra/command.go:1148 +0x384
github.com/spf13/cobra.(*Command).Execute(...)
        /home/kevlar/git-town/vendor/github.com/spf13/cobra/command.go:1071
github.com/git-town/git-town/v22/internal/cmd.Execute()
        /home/kevlar/git-town/internal/cmd/doc.go:49 +0x434
main.main()
        /home/kevlar/git-town/main.go:18 +0x28
panic: interface conversion: tea.Model is nil, not dialog.SwitchModel

goroutine 1 [running]:
github.com/git-town/git-town/v22/internal/cli/dialog.SwitchBranch({{0x40002be890}, 0x2, 0x1, {0x40002de008, 0xc, 0x12}, {{0x40002a7188, 0xc, 0x12}, {0x134d660, ...}, ...}, ...})
        /home/kevlar/git-town/internal/cli/dialog/switch_branch.go:285 +0x59c
github.com/git-town/git-town/v22/internal/cmd.executeSwitch({0x1, {0x400007dd80, 0x0, 0x2}, {0x134d660, 0x0, 0x0}, {0x400023a690, {0x0}, {0x0}, ...}, ...})
        /home/kevlar/git-town/internal/cmd/switch.go:126 +0x560
github.com/git-town/git-town/v22/internal/cmd.switchCmd.func1(0x4000238f08, {0x400007dd80, 0x0, 0x2})
        /home/kevlar/git-town/internal/cmd/switch.go:58 +0x2c4
github.com/spf13/cobra.(*Command).execute(0x4000238f08, {0x400007dd60, 0x2, 0x2})
        /home/kevlar/git-town/vendor/github.com/spf13/cobra/command.go:1015 +0x844
github.com/spf13/cobra.(*Command).ExecuteC(0x400021e008)
        /home/kevlar/git-town/vendor/github.com/spf13/cobra/command.go:1148 +0x384
github.com/spf13/cobra.(*Command).Execute(...)
        /home/kevlar/git-town/vendor/github.com/spf13/cobra/command.go:1071
github.com/git-town/git-town/v22/internal/cmd.Execute()
        /home/kevlar/git-town/internal/cmd/doc.go:49 +0x434
main.main()
        /home/kevlar/git-town/main.go:18 +0x28

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions