Open renatoathaydes opened 6 years ago
I think i have the same issue.
func TestVerify(t *testing.T) {
s, err := govaluate.NewEvaluableExpression("wrongcondition")
assert.Nil(t, err)
tt, err := s.Evaluate(nil)
assert.Nil(t, err)
t.Log(tt)
}
It's panic too Here's the stacktrace:
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=0x20 pc=0x43e9f1e]
goroutine 11 [running]:
testing.tRunner.func1(0xc42030a1e0)
/usr/local/go/src/testing/testing.go:711 +0x2d2
panic(0x4798960, 0x4cab380)
/usr/local/go/src/runtime/panic.go:491 +0x283
git.garena.com/shopee/platform/spex/vendor/github.com/Knetic/govaluate.makeParameterStage.func1(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x46d3d01, 0x1140004c60598)
/Users/vagaa/golang/src/git.garena.com/shopee/platform/spex/vendor/github.com/Knetic/govaluate/evaluationStage.go:217 +0x2e
git.garena.com/shopee/platform/spex/vendor/github.com/Knetic/govaluate.EvaluableExpression.evaluateStage(0x48995dc, 0x22, 0x1, 0xc4200e79a0, 0x1, 0x1, 0xc420089040, 0x488bfd7, 0xe, 0xc420089040, ...)
/Users/vagaa/golang/src/git.garena.com/shopee/platform/spex/vendor/github.com/Knetic/govaluate/EvaluableExpression.go:228 +0x16e
git.garena.com/shopee/platform/spex/vendor/github.com/Knetic/govaluate.EvaluableExpression.Eval(0x48995dc, 0x22, 0x1, 0xc4200e79a0, 0x1, 0x1, 0xc420089040, 0x488bfd7, 0xe, 0x0, ...)
/Users/vagaa/golang/src/git.garena.com/shopee/platform/spex/vendor/github.com/Knetic/govaluate/EvaluableExpression.go:159 +0xa1
git.garena.com/shopee/platform/spex/vendor/github.com/Knetic/govaluate.EvaluableExpression.Evaluate(0x48995dc, 0x22, 0x1, 0xc4200e79a0, 0x1, 0x1, 0xc420089040, 0x488bfd7, 0xe, 0x0, ...)
/Users/vagaa/golang/src/git.garena.com/shopee/platform/spex/vendor/github.com/Knetic/govaluate/EvaluableExpression.go:134 +0xfb
+1 Got bitten by the same.
The following test fails with panic:
I would expect just an error.
Here's the stacktrace: