1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2025-07-04 04:48:38 -04:00

cmd/ofx: check for nil Currency fields in transactions

This commit is contained in:
Martin Habbecke
2021-10-17 12:21:46 -07:00
parent 31229399a0
commit 3d84740a05
3 changed files with 3 additions and 7 deletions

View File

@ -362,11 +362,7 @@ type Currency struct {
}
// Valid returns whether the Currency is valid according to the OFX spec
func (c *Currency) Valid() (bool, error) {
if c == nil {
return false, errors.New("Currency is nil")
}
func (c Currency) Valid() (bool, error) {
if c.CurRate.IsInt() && c.CurRate.Num().Int64() == 0 {
return false, errors.New("CurRate may not be zero")
} else if ok, err := c.CurSym.Valid(); !ok {