Skip to content

Commit ede224c

Browse files
committed
fix: check for null when inspecting array
1 parent c7d16e0 commit ede224c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

object/array.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ func (ao *Array) Inspect() string {
1515
var out bytes.Buffer
1616

1717
elements := []string{}
18-
for _, e := range ao.Elements {
19-
elements = append(elements, e.Inspect())
18+
if len(ao.Elements) != 0 {
19+
for _, e := range ao.Elements {
20+
if e.Inspect() != "" {
21+
elements = append(elements, e.Inspect())
22+
}
23+
}
2024
}
2125

2226
out.WriteString("[")

0 commit comments

Comments
 (0)