mattn / longcat

Looooooooooooooooooooooooooooooooooooooooooooooong cat
MIT License
664 stars 26 forks source link

Validate a name of theme #16

Closed tobynet closed 5 years ago

tobynet commented 5 years ago

Motivation

If the theme does not exist, the longcat causes panic. This is not easy-to-understand for humankind.

2019-09-17_bjj6l-longcat-error

ref. Supporting theme mattn/longcat#12

Before

$ go run main.go -n 2 -H -t wlongcat
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x████████]

goroutine 1 [running]:
main.main()
        ████████████████████████████████████████████longcat/main.go:151 +0x4d5
exit status 2

After

$ go run main.go -n 2 -H -t wlongcat
████████ ████ theme does not exist: wlongcat
exit status 1

$ go run main.go -themes
longcat
tacgnol
mattn commented 5 years ago

Thanks