Skip to content

Commit 9b1d1a9

Browse files
committed
chore: handle error when target.Len == 0
1 parent 90b9082 commit 9b1d1a9

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pkg/jsonpath/token/token.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,10 @@ func (t Tokenizer) ErrorString(target *TokenInfo, msg string) string {
315315

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

321324
return errorBuilder.String()

web/src/assets/wasm/lib.wasm

108 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)