mirror of
https://github.com/shopspring/decimal.git
synced 2024-11-22 12:30:49 +01:00
fix UnmarshalMsg return value. Returns the origanal data if the error occurs.
This commit is contained in:
parent
5f79fa610c
commit
c7eaaded9c
1 changed files with 2 additions and 2 deletions
|
@ -39,12 +39,12 @@ func (d *Decimal) UnmarshalMsg(b []byte) ([]byte, error) {
|
||||||
|
|
||||||
l := len(b)
|
l := len(b)
|
||||||
if l < 1 {
|
if l < 1 {
|
||||||
return nil, errShortBytes
|
return o, err
|
||||||
}
|
}
|
||||||
|
|
||||||
sz := int(b[0] & 0x1f)
|
sz := int(b[0] & 0x1f)
|
||||||
if len(b[1:]) < sz {
|
if len(b[1:]) < sz {
|
||||||
return nil, errShortBytes
|
return o, err
|
||||||
}
|
}
|
||||||
if *d, err = NewFromString(string(b[1 : sz+1])); err == nil {
|
if *d, err = NewFromString(string(b[1 : sz+1])); err == nil {
|
||||||
o = b[sz:]
|
o = b[sz:]
|
||||||
|
|
Loading…
Reference in a new issue