cassava / repoctl

Make it easy to manage your local Arch Linux repository.
MIT License
128 stars 13 forks source link

repols: runtime error if repo not configured #26

Closed AladW closed 8 years ago

AladW commented 8 years ago

If the repo variable is not set in ~/.config/repoctl/config.toml, or the file is not available, repols (from the devel branch) gives a runtime error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x4025a0]

goroutine 1 [running]:
panic(0x846ea0, 0xc82000a130)
        /usr/lib/go/src/runtime/panic.go:481 +0x3e6
main.main()
        /home/archie/go/src/github.com/cassava/repoctl/cmd/repols/main.go:27 +0xb10

In 0.15, a warning message was displayed instead:

Error: repository path must be set in configuration.
cassava commented 8 years ago

Thanks for catching this!

cassava commented 8 years ago

Although I'm kinda wondering if I should have repols not give error messages at all, as it is used in the Zsh completion script.

AladW commented 8 years ago

You could add an 2>/dev/null in the completion script, at least if this is the only context where having error messages makes no sense.