lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Crash after writing commit mesage (using delta diff)

Open DannyJJK opened this issue 1 year ago • 0 comments

Describe the bug After finishing a commit message and pressing enter, lazygit crashed. The commit was successful, so perhaps the issue was related to the diff display (I'm using delta). The crash showed the following message:

panic: runtime error: index out of range [0] with length 0

goroutine 140 [running]:
github.com/jesseduffield/gocui.(*View).writeCells(0xc0007283c0?, 0x61?, 0x5?, {0xc000a91c50?, 0x1?, 0x1?})
	/private/tmp/lazygit-20230201-4388-830qxa/lazygit-0.37.0/vendor/github.com/jesseduffield/gocui/view.go:588 +0x2c7
github.com/jesseduffield/gocui.(*View).writeRunes(0xc0007283c0, {0xc0000fddb8, 0x10, 0x20621d8?})
	/private/tmp/lazygit-20230201-4388-830qxa/lazygit-0.37.0/vendor/github.com/jesseduffield/gocui/view.go:668 +0x345
github.com/jesseduffield/gocui.(*View).writeString(...)
	/private/tmp/lazygit-20230201-4388-830qxa/lazygit-0.37.0/vendor/github.com/jesseduffield/gocui/view.go:683
github.com/jesseduffield/gocui.(*View).SetContent(0xc0007283c0, {0xc0009b0cb0, 0x10})
	/private/tmp/lazygit-20230201-4388-830qxa/lazygit-0.37.0/vendor/github.com/jesseduffield/gocui/view.go:795 +0x17b
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).setViewContent(0xc000114f00?, 0x1015465?, {0x180a7f7?, 0xc000114f00?})
	/private/tmp/lazygit-20230201-4388-830qxa/lazygit-0.37.0/pkg/gui/view_helpers.go:24 +0x39
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).renderString(0xc00068da00?, 0xc000697758?, {0x180a7f7?, 0x173ddc0?})
	/private/tmp/lazygit-20230201-4388-830qxa/lazygit-0.37.0/pkg/gui/view_helpers.go:35 +0x4f
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).newStringTaskWithKey.func1(0x47fd969d?)
	/private/tmp/lazygit-20230201-4388-830qxa/lazygit-0.37.0/pkg/gui/tasks_adapter.go:87 +0x29
github.com/jesseduffield/lazygit/pkg/tasks.(*ViewBufferManager).NewTask.func1.3()
	/private/tmp/lazygit-20230201-4388-830qxa/lazygit-0.37.0/pkg/tasks/tasks.go:282 +0x33
github.com/jesseduffield/lazygit/pkg/utils.Safe.func1()
	/private/tmp/lazygit-20230201-4388-830qxa/lazygit-0.37.0/pkg/utils/utils.go:108 +0x1b
github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0x1040185?)
	/private/tmp/lazygit-20230201-4388-830qxa/lazygit-0.37.0/pkg/utils/utils.go:119 +0x67
github.com/jesseduffield/lazygit/pkg/utils.Safe(0x0?)
	/private/tmp/lazygit-20230201-4388-830qxa/lazygit-0.37.0/pkg/utils/utils.go:108 +0x35
created by github.com/jesseduffield/lazygit/pkg/tasks.(*ViewBufferManager).NewTask.func1
	/private/tmp/lazygit-20230201-4388-830qxa/lazygit-0.37.0/pkg/tasks/tasks.go:281 +0x3a5

To Reproduce Steps to reproduce the behavior:

To be honest I'm not sure how to replicate it, it happened unexpectedly and I've used lazygit a lot without any issues. Maybe someone else may know?

Expected behavior To complete the commit as normal.

Version info: commit=, build date=, build source=homebrew, version=0.37.0, os=darwin, arch=amd64, git version=2.39.1 git version 2.39.1

Additional context Not sure if this is related to #1688

DannyJJK avatar Feb 07 '23 15:02 DannyJJK