Skip to content

Commit

Permalink
Merge pull request #239 from sardap/psarda/fix-output-nil-not-checked
Browse files Browse the repository at this point in the history
Added checks for nil output when adding consumed capacity
  • Loading branch information
guregu committed Jun 30, 2024
2 parents ab7d057 + 9b0b3da commit 06919cf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (d *Delete) run(ctx context.Context) (*dynamodb.DeleteItemOutput, error) {
output, err = d.table.db.client.DeleteItem(ctx, input)
return err
})
if d.cc != nil {
if d.cc != nil && output != nil {
addConsumedCapacity(d.cc, output.ConsumedCapacity)
}
return output, err
Expand Down
2 changes: 1 addition & 1 deletion put.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (p *Put) run(ctx context.Context) (output *dynamodb.PutItemOutput, err erro
output, err = p.table.db.client.PutItem(ctx, req)
return err
})
if p.cc != nil {
if p.cc != nil && output != nil {
addConsumedCapacity(p.cc, output.ConsumedCapacity)
}
return
Expand Down
2 changes: 1 addition & 1 deletion update.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func (u *Update) run(ctx context.Context) (*dynamodb.UpdateItemOutput, error) {
output, err = u.table.db.client.UpdateItem(ctx, input)
return err
})
if u.cc != nil {
if u.cc != nil && output != nil {
addConsumedCapacity(u.cc, output.ConsumedCapacity)
}
return output, err
Expand Down

0 comments on commit 06919cf

Please sign in to comment.