Skip to content

Commit

Permalink
Merge pull request #4 from ceshihao/fix/toIDispatchErr
Browse files Browse the repository at this point in the history
fix VARIANT is nil in toIDispatchErr
  • Loading branch information
ceshihao authored Jul 7, 2022
2 parents fd2de94 + 7c8d529 commit a6bb9fd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion oleconv.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func toIDispatchErr(result *ole.VARIANT, err error) (*ole.IDispatch, error) {
if err != nil {
return nil, err
}
return result.ToIDispatch(), nil
return variantToIDispatch(result), nil
}

func toInt64Err(result *ole.VARIANT, err error) (int64, error) {
Expand Down Expand Up @@ -75,6 +75,13 @@ func toTimeErr(result *ole.VARIANT, err error) (*time.Time, error) {
return variantToTime(result), nil
}

func variantToIDispatch(v *ole.VARIANT) *ole.IDispatch {
if v == nil {
return nil
}
return v.ToIDispatch()
}

func variantToInt64(v *ole.VARIANT) int64 {
value := v.Value()
if value == nil {
Expand Down

0 comments on commit a6bb9fd

Please sign in to comment.