Skip to content

Commit

Permalink
chore: handle error when target.Len == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasRooney committed Jan 13, 2025
1 parent 90b9082 commit 9b1d1a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/jsonpath/token/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ func (t Tokenizer) ErrorString(target *TokenInfo, msg string) string {

// Write the caret symbol pointing to the target token
errorBuilder.WriteString(spaces)
dots := strings.Repeat(".", target.Len-1)
dots := ""
if target.Len > 0 {
dots = strings.Repeat(".", target.Len-1)
}
errorBuilder.WriteString("^" + dots + "\n")

return errorBuilder.String()
Expand Down
Binary file modified web/src/assets/wasm/lib.wasm
Binary file not shown.

0 comments on commit 9b1d1a9

Please sign in to comment.