jesseduffield / lazygit

simple terminal UI for git commands
MIT License
52.99k stars 1.85k forks source link

Crash when filtering by author #3812

Closed mark2185 closed 2 months ago

mark2185 commented 3 months ago

Describe the bug The application crashes when filtering the commits by user (but not always, can't really pinpoint it, it's something when refreshing the view).

To Reproduce Steps to reproduce the behavior:

  1. Open lazygit in the lazygit repo
  2. Go to commits panel
  3. Filter the commits by author, e.g. Luke Swan (note: can pretty consistently crash it with this author or myself, but not all of them)
  4. Exit that view, press <c-s> again and just press Filter by <the current author>
  5. Crash

Expected behavior No crashes.

Screenshots Asciinema recording here.

Version info: lazygit version: built latest master as of today, git version 2.46.0

Additional context It seems like these columnPositions have only one element so both accesses are out of bounds.

Note: please try updating to the latest version or manually building the latest master to see if the issue still occurs.

stefanhaller commented 3 months ago

I can reproduce it, I'll have a look. I think it happens whenever you are scrolled down so much that the selection index in the unfiltered list is larger than the length of the filtered list.

stefanhaller commented 2 months ago

@mark2185 Here's a fix, can you please have a look and/or test? #3838

mark2185 commented 2 months ago

@stefanhaller seems to have done it, I can't crash it anymore, thanks!

As for reviewing, all the gocui things go over my head so can't really pass judgement on that.