diff options
| author | Charlie Stanton <charlie@shtanton.xyz> | 2024-03-25 15:36:31 +0000 | 
|---|---|---|
| committer | Charlie Stanton <charlie@shtanton.xyz> | 2024-03-25 15:36:31 +0000 | 
| commit | e9a296e8bc8f25138ea5910c8b09661f8ae25f10 (patch) | |
| tree | a14068e694b268872e6f605b3db0164ae875ec0e /json/write.go | |
| parent | c6c1c67402f89c94fee040c2c740d96e61cab669 (diff) | |
| download | stred-go-e9a296e8bc8f25138ea5910c8b09661f8ae25f10.tar | |
Fix bug in json/write.go inMapAt and inArrayAt
Diffstat (limited to 'json/write.go')
| -rw-r--r-- | json/write.go | 8 | 
1 files changed, 4 insertions, 4 deletions
| diff --git a/json/write.go b/json/write.go index c2a220e..334dfc0 100644 --- a/json/write.go +++ b/json/write.go @@ -209,7 +209,7 @@ func (writer *JSONWriter) navigateTo(keepLen int, path []walk.PathSegment, state  }  func (writer *JSONWriter) inMapAt(keepLen int, path []walk.PathSegment) bool { -	if keepLen < len(path) { +	if len(path) != 0 {  		return false  	} @@ -217,12 +217,12 @@ func (writer *JSONWriter) inMapAt(keepLen int, path []walk.PathSegment) bool {  		return writer.state == JSONWriterStateInMap  	} -	_, isString := writer.path[keepLen].(string) +	_, isString := writer.path[0].(string)  	return isString  }  func (writer *JSONWriter) inArrayAt(keepLen int, path []walk.PathSegment) bool { -	if keepLen < len(path) { +	if len(path) != 0 {  		return false  	} @@ -230,7 +230,7 @@ func (writer *JSONWriter) inArrayAt(keepLen int, path []walk.PathSegment) bool {  		return writer.state == JSONWriterStateInArray  	} -	_, isInt := writer.path[keepLen].(int) +	_, isInt := writer.path[0].(int)  	return isInt  } | 
