rgburke/grv

index out of range

axel22 opened this issue · 3 comments

Scenario - go to a repository with a dirty index but nothing staged:

1. $ grv
2. <g-t> to switch to next tab
3. <Tab> to switch to the diff view (which is empty, unless something is staged).
4. <Enter>

Output:

anic: runtime error: index out of range

                                       goroutine 45 [running]:
                                                              main.selectDiffLine(0xc420174180, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x0)
                                                                                                                              	/home/richard/code/goworkspace/src/github.com/rgburke/grv/cmd/grv/diff_view.go:736 +0x47d
                                                                                                                                                                                                                         main.(*DiffView).HandleAction(0xc420174180, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x0)
                                                                                                                                                                                                                                                                                                   	/home/richard/code/goworkspace/src/github.com/rgburke/grv/cmd/grv/diff_view.go:634 +0x1de
                                                                   main.(*ContainerView).HandleAction(0xc4200bc420, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x0)
                                                                                                                                                  	/home/richard/code/goworkspace/src/github.com/rgburke/grv/cmd/grv/container_view.go:195 +0x11a
                                                                                                                                                                                                                                                      main.(*View).HandleAction(0xc4201900f0, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x0)
                                                                                                                                                                                                                                                                                                                            	/home/richard/code/goworkspace/src/github.com/rgburke/grv/cmd/grv/view.go:527 +0x29f
                                                                                   main.(*GRV).runHandlerLoop(0xc42010fae0, 0xc4201ca040, 0xc42008c7e0, 0xc4200c08a0, 0xc4200c0900, 0xc4200c09c0, 0xc4200c0960)
                                                                                                                                                                                                               	/home/richard/code/goworkspace/src/github.com/rgburke/grv/cmd/grv/grv.go:473 +0x532
                                                                                                                                                                                                                                                                                                   created by main.(*GRV).Run
                                                                                                                                                                                                                                                                                                                             /home/richard/code/goworkspace/src/github.com/rgburke/grv/cmd/grv/grv.go:299 +0x1bc
                                                                                  ⏎ 

Hi, thanks for reporting this. Could you confirm which version of GRV you're using and on which OS? This issue should be fixed in the latest version of GRV.

Version:

GRV - Git Repository Viewer v0.3.0-0-g5589a31 (compiled with go1.10.4 at 2018-09-29 11:55:05 BST)

OS is Ubuntu 18.04:

4.15.0-36-generic #39-Ubuntu ... x86_64 x86_64 x86_64 GNU/Linux

Btw, I also noticed that when I look at the changes in a repo with changes, the first changed file is always reported as having not changes, when in fact it does.