diff --git a/amount.go b/amount.go index a15b311..e3d6de2 100644 --- a/amount.go +++ b/amount.go @@ -360,7 +360,10 @@ func (a Amount) Value() (driver.Value, error) { // Allows scanning amounts from a PostgreSQL composite type. func (a *Amount) Scan(src interface{}) error { // Wire format: "(9.99,USD)". - input := src.(string) + input, ok := src.(string) + if !ok { + return fmt.Errorf("invalid src: %v", src) + } if len(input) == 0 { return nil }