Skip to content

Commit

Permalink
Fixing potential for nil pointer errors in parsing json
Browse files Browse the repository at this point in the history
  • Loading branch information
samlown committed Jan 31, 2024
1 parent 4a48821 commit 655041c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bill/outlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (o *Outlay) Validate() error {
// UnmarshalJSON helps migrate the desc field to description.
func (o *Outlay) UnmarshalJSON(data []byte) error {
type Alias Outlay
aux := &struct {
aux := struct {
Desc string `json:"desc"`
*Alias
}{
Expand Down
2 changes: 1 addition & 1 deletion pay/advance.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (a *Advance) CalculateFrom(totalWithTax num.Amount) {
// UnmarshalJSON helps migrate the desc field to description.
func (a *Advance) UnmarshalJSON(data []byte) error {
type Alias Advance
aux := &struct {
aux := struct {
Desc string `json:"desc,omitempty"`
*Alias
}{
Expand Down
2 changes: 1 addition & 1 deletion tax/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (c *Combo) prepare(r *Regime, zone l10n.Code, date cal.Date) error {
// the rate field.
func (c *Combo) UnmarshalJSON(data []byte) error {
type Alias Combo
aux := &struct {
aux := struct {
*Alias
Tags []cbc.Key `json:"tags"`
}{
Expand Down

0 comments on commit 655041c

Please sign in to comment.