climech / grit

Multitree-based personal task manager
MIT License
1.67k stars 47 forks source link

nil pointer error when link to non-existent task #22

Closed reytarovskiy closed 3 years ago

reytarovskiy commented 3 years ago

When i create link to non-existent task, i get this error:

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

goroutine 1 [running]:
github.com/jawher/mow.cli/internal/flow.(*Step).Run(0xc000100870, 0x643f80, 0x790df0)
    /home/anton/go/pkg/mod/github.com/jawher/mow.cli@v1.2.0/internal/flow/flow.go:39 +0xd8
github.com/jawher/mow.cli/internal/flow.(*Step).Run(0xc0001008d0, 0x643f80, 0x790df0)
    /home/anton/go/pkg/mod/github.com/jawher/mow.cli@v1.2.0/internal/flow/flow.go:29 +0xbb
github.com/jawher/mow.cli/internal/flow.(*Step).Run(0xc000100b40, 0x643f80, 0x790df0)
    /home/anton/go/pkg/mod/github.com/jawher/mow.cli@v1.2.0/internal/flow/flow.go:29 +0xbb
github.com/jawher/mow.cli/internal/flow.(*Step).callDo.func1(0xc000100b70, 0x0, 0x0)
    /home/anton/go/pkg/mod/github.com/jawher/mow.cli@v1.2.0/internal/flow/flow.go:52 +0x4e
panic(0x643f80, 0x790df0)
    /usr/lib/go/src/runtime/panic.go:965 +0x1b9
github.com/climech/grit/multitree.validateNewLink(0x0, 0xc000124070, 0xc0001243f0, 0xc000124700)
    /home/anton/.cache/pacaur/grit-task-manager/src/grit/multitree/node.go:313 +0x26
github.com/climech/grit/multitree.LinkNodes(0x0, 0xc000124070, 0xc000124070, 0x0)
    /home/anton/.cache/pacaur/grit-task-manager/src/grit/multitree/node.go:345 +0x39
github.com/climech/grit/db.createLink(0xc000118280, 0xa, 0x6, 0x0, 0x0, 0x6)
    /home/anton/.cache/pacaur/grit-task-manager/src/grit/db/link.go:55 +0x9f
github.com/climech/grit/db.(*Database).CreateLink.func1(0xc000118280, 0xc000118280, 0x0)
    /home/anton/.cache/pacaur/grit-task-manager/src/grit/db/link.go:73 +0x46
github.com/climech/grit/db.(*Database).execTxFunc(0xc00000e288, 0xc00011f938, 0x0, 0x0)
    /home/anton/.cache/pacaur/grit-task-manager/src/grit/db/db.go:79 +0x5d
github.com/climech/grit/db.(*Database).CreateLink(0xc00000e288, 0xa, 0x6, 0x6, 0x0, 0x0)
    /home/anton/.cache/pacaur/grit-task-manager/src/grit/db/link.go:80 +0x79
github.com/climech/grit/app.(*App).LinkNodes(0xc000010180, 0x638ec0, 0xc000056800, 0x638ec0, 0xc000056810, 0x73, 0x0, 0x0)
    /home/anton/.cache/pacaur/grit-task-manager/src/grit/app/app.go:206 +0x225
main.cmdLink.func1()
    /home/anton/.cache/pacaur/grit-task-manager/src/grit/cmd/grit/cmds.go:190 +0x1a5
github.com/jawher/mow.cli/internal/flow.(*Step).callDo(0xc000100b70, 0x0, 0x0)
    /home/anton/go/pkg/mod/github.com/jawher/mow.cli@v1.2.0/internal/flow/flow.go:55 +0x70
github.com/jawher/mow.cli/internal/flow.(*Step).Run(0xc000100b70, 0x0, 0x0)
    /home/anton/go/pkg/mod/github.com/jawher/mow.cli@v1.2.0/internal/flow/flow.go:25 +0x45
github.com/jawher/mow.cli/internal/flow.(*Step).Run(0xc000100b10, 0x0, 0x0)
    /home/anton/go/pkg/mod/github.com/jawher/mow.cli@v1.2.0/internal/flow/flow.go:29 +0xbb
github.com/jawher/mow.cli/internal/flow.(*Step).Run(0xc0001008a0, 0x0, 0x0)
    /home/anton/go/pkg/mod/github.com/jawher/mow.cli@v1.2.0/internal/flow/flow.go:29 +0xbb
github.com/jawher/mow.cli/internal/flow.(*Step).Run(0xc000053eb8, 0x0, 0x0)
    /home/anton/go/pkg/mod/github.com/jawher/mow.cli@v1.2.0/internal/flow/flow.go:29 +0xbb
github.com/jawher/mow%2ecli.(*Cmd).parse(0xc000116700, 0xc0000120e0, 0x2, 0x2, 0xc000053eb8, 0xc0001008a0, 0xc0001008d0, 0xc000100200, 0xc000060100)
    /home/anton/go/pkg/mod/github.com/jawher/mow.cli@v1.2.0/commands.go:693 +0x53c
github.com/jawher/mow%2ecli.(*Cmd).parse(0xc000116000, 0xc0000120d0, 0x3, 0x3, 0xc000053eb8, 0xc000053eb8, 0xc000100870, 0x0, 0x659bc0)
    /home/anton/go/pkg/mod/github.com/jawher/mow.cli@v1.2.0/commands.go:707 +0x785
github.com/jawher/mow%2ecli.(*Cli).parse(0xc000053f48, 0xc0000120d0, 0x3, 0x3, 0xc000053eb8, 0xc000053eb8, 0xc000100870, 0x1, 0xc000118080)
    /home/anton/go/pkg/mod/github.com/jawher/mow.cli@v1.2.0/cli.go:76 +0x85
github.com/jawher/mow%2ecli.(*Cli).Run(0xc000053f48, 0xc0000120c0, 0x4, 0x4, 0x18, 0x678d00)
    /home/anton/go/pkg/mod/github.com/jawher/mow.cli@v1.2.0/cli.go:105 +0x12b
main.main()
    /home/anton/.cache/pacaur/grit-task-manager/src/grit/cmd/grit/main.go:36 +0x5bf
reytarovskiy commented 3 years ago

Sorry, i tested it on previous version, it fixed in master branch