Skip to content

Commit

Permalink
correct bad handle error
Browse files Browse the repository at this point in the history
  • Loading branch information
realPy committed Jul 19, 2023
1 parent 5bd519f commit c625f43
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ func Unmarshal(q QuerySelector, s interface{}) error {
array := reflect.MakeSlice(f.Type(), 0, ln)
for i := 0; i < ln; i++ {

if objjs, err := nodelist.GetIndex(i); err != nil {
if r, err := baseobject.Discover(objjs); err != nil {
if objjs, err := nodelist.GetIndex(i); err == nil {
if r, err := baseobject.Discover(objjs); err == nil {
array = reflect.Append(array, reflect.ValueOf(r))
}

Expand All @@ -115,7 +115,7 @@ func Unmarshal(q QuerySelector, s interface{}) error {
if err != nil {
return err
}
if delem, err := elem.Discover(); err != nil {
if delem, err := elem.Discover(); err == nil {

if v.Kind() == reflect.Struct {
f.Set(reflect.ValueOf(delem))
Expand Down

0 comments on commit c625f43

Please sign in to comment.