diff --git a/delete.go b/delete.go index 85ca119..67a3710 100644 --- a/delete.go +++ b/delete.go @@ -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 diff --git a/put.go b/put.go index 4d43b71..08fc277 100644 --- a/put.go +++ b/put.go @@ -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 diff --git a/update.go b/update.go index f841769..d8e6d0d 100644 --- a/update.go +++ b/update.go @@ -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