fix lib.go handled error (#1418)

This commit is contained in:
Jingyu 2022-11-09 18:36:53 +08:00 committed by GitHub
parent bd5e5dc965
commit 91b3fb2af3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -263,6 +263,9 @@ func parseSnippet(value string) (*yaml.Node, error) {
return nil, err return nil, err
} }
parsedNode, err := decoder.Decode() parsedNode, err := decoder.Decode()
if err != nil {
return nil, err
}
if len(parsedNode.Node.Content) == 0 { if len(parsedNode.Node.Content) == 0 {
return nil, fmt.Errorf("bad data") return nil, fmt.Errorf("bad data")
} }