CGamesPlay / dfm

dotfile manager with 0 dependencies, minimal configuration, and automatic cleanup
BSD Zero Clause License
70 stars 1 forks source link

runtime error: when trying to add non-existent file #2

Closed marconett closed 4 years ago

marconett commented 4 years ago

Not a big deal, but kind of ugly: dfm dies when you try to add a file that can't be found: dfm add i_dont_exist (I'm on macOS).

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

goroutine 1 [running]:
main.(*Dfm).AddFiles(0xc0000b7650, 0xc00008d070, 0x1, 0x1, 0xc0001495c4, 0x5, 0xc0000d1c01, 0x1478e60, 0x0, 0x0)
        /Users/rpatterson/Projects/dfm/Dfm.go:193 +0x132
main.runAdd(0xc0000c7b80, 0xc00008d070, 0x1, 0x1)
        /Users/rpatterson/Projects/dfm/main.go:102 +0xcd
github.com/spf13/cobra.(*Command).execute(0xc0000c7b80, 0xc00008d040, 0x1, 0x1, 0xc0000c7b80, 0xc00008d040)
        /Users/rpatterson/.virtualgo/dfm/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000c7180, 0xc0000d1f48, 0x1, 0x1)
        /Users/rpatterson/.virtualgo/dfm/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/rpatterson/.virtualgo/dfm/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main()
        /Users/rpatterson/Projects/dfm/main.go:224 +0xaa7

as a side note (I dont want to spam github issues..), the output of dfm --help is not quite accurate: it states that the user should execute dfm init . --repos files, but the correct command would be dfm init --repos files.

CGamesPlay commented 4 years ago

resolved in 9d0dd04. Thanks for reporting! Obviously, the problem was that I was swallowing the error message 🤦‍♂