skanehira/docui

nil deref panic on ctrl-L with no containers running

Opened this issue · 4 comments

My local docker currently has no containers running; exploring docui on a fresh download ( 08d7aa1 ) I pressed Ctrl-L and got a nil dereference panic.

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

goroutine 84 [running]:
github.com/skanehira/docui/panel.(*ContainerList).ShowContainerLogs.func1(0xc000356380, 0xc0003904e0)
	/home/pdp/go/src/github.com/skanehira/docui/panel/containerPanel.go:716 +0x8f
created by github.com/skanehira/docui/panel.(*ContainerList).ShowContainerLogs
	/home/pdp/go/src/github.com/skanehira/docui/panel/containerPanel.go:708 +0x1e7

Compiled with go1.13beta1. But really, "no containers, ask to view logs of container, get a panic".

@it-philpennock
Thank you for repoting :)
I'll fix this problem :)

@skanehira have you already started working on this? I'd like to give it a go if not and contribute to this project :)

@skanehira I tried fixing it by moving the container selection out of the goroutine, let me know what you think.

@giorgioprevitera Thank you for helping :)
I merged your PR