Skip to content

Commit

Permalink
fix: check for null when inspecting array
Browse files Browse the repository at this point in the history
  • Loading branch information
AvicennaJr committed Oct 11, 2023
1 parent c7d16e0 commit ede224c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions object/array.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ func (ao *Array) Inspect() string {
var out bytes.Buffer

elements := []string{}
for _, e := range ao.Elements {
elements = append(elements, e.Inspect())
if len(ao.Elements) != 0 {
for _, e := range ao.Elements {
if e.Inspect() != "" {
elements = append(elements, e.Inspect())
}
}
}

out.WriteString("[")
Expand Down

0 comments on commit ede224c

Please sign in to comment.