Skip to content

Commit

Permalink
Fix null check (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubhaankar-Sharma authored Sep 24, 2024
1 parent b688502 commit c416b78
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/prototyp/bigint.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ func (b *BigInt) UnmarshalText(text []byte) error {
if len(text) <= 2 || t == "null" || t == "" {
return nil
}
i, _ := big.NewInt(0).SetString(string(text[1:len(text)-1]), 10)
i, ok := big.NewInt(0).SetString(string(text[1:len(text)-1]), 10)
if !ok {
return fmt.Errorf("BigInt.UnmarshalText: failed to unmarshal %q", text)
}
*b = BigInt(*i)
return nil
}
Expand Down

0 comments on commit c416b78

Please sign in to comment.