isacikgoz / gitbatch

manage your git repositories in one place
MIT License
1.54k stars 53 forks source link

0.4.1 - Crash when click tab immediately after startup #76

Closed karayel closed 5 years ago

karayel commented 5 years ago

Hı,

Thanks for such a great tool like this one. I am happy to use it.

I am facing the following issue when I click tab immediately after the startup . Here is my assumption about the problem this may help for hotfix. It seems to me when there is no repository in the panel and click tab button in the keyboard. The following exception occurs.

Using version 0.4.1

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb8 pc=0x86676c]

goroutine 1 [running]:
github.com/isacikgoz/gitbatch/gui.(*Gui).focusToRepository(0xc42016efa0, 0xc4200da2d0, 0xc420184d20, 0xc42006afc0, 0xc42006afc0)
        /home/isacikgoz/.local/share/go/src/github.com/isacikgoz/gitbatch/gui/focus.go:101 +0xbc
github.com/isacikgoz/gitbatch/gui.(*Gui).(github.com/isacikgoz/gitbatch/gui.focusToRepository)-fm(0xc4200da2d0, 0xc420184d20, 0x4, 0xc420063b01)
        /home/isacikgoz/.local/share/go/src/github.com/isacikgoz/gitbatch/gui/keybindings.go:215 +0x3e
github.com/jroimartin/gocui.(*Gui).execKeybindings(0xc4200da2d0, 0xc420184d20, 0xc420063b48, 0x857599, 0x0, 0x0)
        /home/isacikgoz/.local/share/go/src/github.com/jroimartin/gocui/gui.go:629 +0xce
github.com/jroimartin/gocui.(*Gui).onKey(0xc4200da2d0, 0xc420063b48, 0xc4201ef9e0, 0xc42013f260)
        /home/isacikgoz/.local/share/go/src/github.com/jroimartin/gocui/gui.go:593 +0x1b3
github.com/jroimartin/gocui.(*Gui).handleEvent(0xc4200da2d0, 0xc420063b48, 0xc4200e7b40, 0x0)
        /home/isacikgoz/.local/share/go/src/github.com/jroimartin/gocui/gui.go:413 +0x40
github.com/jroimartin/gocui.(*Gui).MainLoop(0xc4200da2d0, 0xc4200da2d0, 0x0)
        /home/isacikgoz/.local/share/go/src/github.com/jroimartin/gocui/gui.go:373 +0x2cf
github.com/isacikgoz/gitbatch/gui.(*Gui).Run(0xc42016efa0, 0x0, 0x0)
        /home/isacikgoz/.local/share/go/src/github.com/isacikgoz/gitbatch/gui/gui.go:140 +0x1ee
main.run(0x0, 0x0, 0x0, 0xb13646, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/isacikgoz/git/gitbatch/main.go:52 +0x122
main.main()
        /home/isacikgoz/git/gitbatch/main.go:24 +0xc2
isacikgoz commented 5 years ago

Thanks for the comprehensive feedback @karayel You are right, It happens because the are no repositories loaded. I can apply a hotfix for this just as you proposed.

isacikgoz commented 5 years ago

I've just fixed it and it's merged to master. Please let me know if you still the issue. Also, feel free to open a new issue.