Skip to content

Commit

Permalink
Fix invalid type assertion in LoadBytes (#733)
Browse files Browse the repository at this point in the history
Fixes #732
  • Loading branch information
moorereason authored Jan 5, 2022
1 parent 1baee46 commit fed1464
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4119,3 +4119,13 @@ ErrorField = "foo"
t.Fatalf("error was expected")
}
}

func TestGithubIssue732(t *testing.T) {
var v interface{}
data := []byte("a=\nb=0")

err := Unmarshal(data, &v)
if err == nil {
t.Fatalf("error was expected")
}
}
2 changes: 1 addition & 1 deletion toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ func LoadBytes(b []byte) (tree *Tree, err error) {
if _, ok := r.(runtime.Error); ok {
panic(r)
}
err = errors.New(r.(string))
err = fmt.Errorf("%s", r)
}
}()

Expand Down

0 comments on commit fed1464

Please sign in to comment.