Skip to content

Pressing enter in empty remote branch list leads to panic #643

Closed
@eriksixt

Description

Describe the bug
In a new repository without any remotes configured, pressing ENTER in the empty branch list leads to panic (index out of bounds).

To Reproduce
Steps to reproduce the behavior:

  1. Create a new repository
  2. start gitui
  3. Press b to bring up branch selection
  4. Press TAB to switch to remote branch list
  5. Press ENTER

Expected behavior
Application does not crash

Details
panic: PanicInfo { payload: Any, message: Some(index out of bounds: the len is 0 but the index is 0), location: Location { file: "src/components/branchlist.rs", line: 445, col: 18 } } trace: 0: backtrace::capture::Backtrace::new 1: gitui::set_panic_handlers::{{closure}} 2: std::panicking::rust_panic_with_hook 3: std::panicking::begin_panic_handler::{{closure}} 4: std::sys_common::backtrace::__rust_end_short_backtrace 5: _rust_begin_unwind 6: core::panicking::panic_fmt 7: core::panicking::panic_bounds_check 8: <alloc::vec::Vec<T,A> as core::ops::index::Index<I>>::index 9: <gitui::components::branchlist::BranchListComponent as gitui::components::Component>::event 10: gitui::components::event_pump 11: gitui::main 12: std::sys_common::backtrace::__rust_begin_short_backtrace 13: _main

Context (please complete the following information):

  • OS/Distro + Version: macOS 11.2.3
  • GitUI Version: 0.14.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions