Fixed handling of json decoding error #1423

This commit is contained in:
Mike Farah
2022-11-10 22:33:43 +11:00
parent ececd00fbd
commit 3435fee1f9
2 changed files with 18 additions and 1 deletions
+4
View File
@@ -46,6 +46,10 @@ func (o *orderedMap) UnmarshalJSON(data []byte) error {
// cycle through k/v
var tok json.Token
for tok, err = dec.Token(); !errors.Is(err, io.EOF); tok, err = dec.Token() {
if err != nil && !errors.Is(err, io.EOF) {
return err
}
// we can expect two types: string or Delim. Delim automatically means
// that it is the closing bracket of the object, whereas string means
// that there is another key.