Skip to content

Commit ca5d320

Browse files
authored
Merge branch 'master' into docs-update/index
2 parents 69c6aa0 + ffddc26 commit ca5d320

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

internal/function/uast.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ func posToString(pos uast.Positions) string {
575575

576576
func extractAnyProp(node nodes.Object, key string) []interface{} {
577577
v, ok := node[key]
578-
if !ok {
578+
if !ok || v == nil {
579579
return nil
580580
}
581581

internal/function/uast_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,14 @@ func TestUASTChildren(t *testing.T) {
322322
}
323323
}
324324

325+
func TestExtractAnyProp(t *testing.T) {
326+
node, key := make(nodes.Object), "foo"
327+
node[key] = nil
328+
329+
props := extractAnyProp(node, key)
330+
require.Nil(t, props)
331+
}
332+
325333
func assertUASTBlobs(t *testing.T, ctx *sql.Context, a, b interface{}) {
326334
t.Helper()
327335
var require = require.New(t)

0 commit comments

Comments
 (0)