diff --git a/postgres/numeric.go b/postgres/numeric.go index cf8dea4..9483e87 100644 --- a/postgres/numeric.go +++ b/postgres/numeric.go @@ -93,7 +93,7 @@ func (n Numeric) Add(other Numeric) Numeric { } func (n Numeric) String() string { - if n.Int.Int64() == 0 { + if n.Int == nil || n.Int.Int64() == 0 { return "0" } @@ -130,7 +130,7 @@ func (n Numeric) String() string { } func (n Numeric) MarshalJSON() ([]byte, error) { - if n.Int.Int64() == 0 { + if n.Int == nil || n.Int.Int64() == 0 { return []byte("0"), nil }