Syntax error beginning with "~" crashes instead of indicating "Unkown syntax" error
Curiously, the problem only happens when a repo is loaded.
$ reposurgeon
reposurgeon% ~max(=C)
*** Unknown syntax: max(=C)
reposurgeon% read <simple.fi
131 events (56K/s)
* simple
reposurgeon% ~max(=C)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
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=0x8d3dc3]
goroutine 1 [running]:
main.main.func1()
/data/dan/reposurgeon/surgeon/reposurgeon.go:17480 +0x422
panic(0x9a8280, 0xf3e960)
/usr/lib/golang/src/runtime/panic.go:679 +0x1b2
main.catch(0xa4120a, 0x7, 0x9a8280, 0xf3e960, 0x0)
/data/dan/reposurgeon/surgeon/reposurgeon.go:196 +0x29b
main.(*Reposurgeon).PreCmd.func1(0xc0002659e8)
/data/dan/reposurgeon/surgeon/reposurgeon.go:9775 +0x66
panic(0x9a8280, 0xf3e960)
/usr/lib/golang/src/runtime/panic.go:679 +0x1b2
main.(*SelectionParser).evalTermNegate(0xc000170040, 0xb4d520, 0xc000170040, 0xc0000fc030, 0x0, 0x0)
/data/dan/reposurgeon/surgeon/selection.go:831 +0x73
main.(*SelectionParser).parseTerm.func1(0xb4d520, 0xc000170040, 0xc0000fc030, 0x0)
/data/dan/reposurgeon/surgeon/selection.go:803 +0x95
main.(*SelectionParser).evaluate(0xc000170040, 0xc00000e020, 0xb4d520, 0xc000170040, 0x0, 0x0, 0x0)
/data/dan/reposurgeon/surgeon/selection.go:678 +0x7f
main.(*Reposurgeon).evalSelectionSet(0xc000170000, 0xc00000e020, 0xc000268000, 0x0, 0x0, 0x0)
/data/dan/reposurgeon/surgeon/selection.go:37 +0x145
main.(*Reposurgeon).PreCmd(0xc000170000, 0xc0002be190, 0x8, 0x0, 0x0)
/data/dan/reposurgeon/surgeon/reposurgeon.go:9790 +0x467
reflect.callMethod(0xc0001a5840, 0xc000265b10, 0xc000265af8)
/usr/lib/golang/src/reflect/value.go:714 +0x1f0
reflect.methodValueCall(0xc0002be190, 0x8, 0x34a13, 0x97a401, 0x98ef80, 0xc0001a5840, 0xc000265bc0, 0x7d3b55, 0xb4eae0, 0xc0001483f0, ...)
/usr/lib/golang/src/reflect/asm_amd64.s:35 +0x42
gitlab.com/ianbruene/kommandant.(*Kmdt).bind.func5(0xb4eae0, 0xc0001483f0, 0xc0002be190, 0x8, 0x8, 0xa4a140)
/users/d00u3151/go/pkg/mod/gitlab.com/ianbruene/kommandant@v0.6.0/kommandant.go:350 +0x73
gitlab.com/ianbruene/kommandant.(*Kmdt).PreCmd(0xc0001742c0, 0xb4eae0, 0xc0001483f0, 0xc0002be190, 0x8, 0xf, 0x0)
/users/d00u3151/go/pkg/mod/gitlab.com/ianbruene/kommandant@v0.6.0/kommandant.go:213 +0x145
gitlab.com/ianbruene/kommandant.(*Kmdt).CmdLoop(0xc0001742c0, 0xb4eae0, 0xc0001483f0, 0x0, 0x0)
/users/d00u3151/go/pkg/mod/gitlab.com/ianbruene/kommandant@v0.6.0/kommandant.go:632 +0x119
main.main()
/data/dan/reposurgeon/surgeon/reposurgeon.go:17506 +0x708
Edited by Dan Howell