Skip to content

Commit b3a5c39

Browse files
committed
fix another nil pointer
1 parent 362c1ef commit b3a5c39

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/datastore/transaction_rpc.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"math"
78
"strings"
89
"time"
910

@@ -224,8 +225,13 @@ func (d *Datastore) lowlevelTransactionSet(ctx context.Context, transaction *typ
224225
// clear the owners existing explicit delete entries, retrieving the old entries for storing in the transaction for possible rollback
225226
oldExplicitDeletes := root.RemoveExplicitDeletes(intent.GetName())
226227

228+
priority := int32(math.MaxInt32)
229+
if len(oldIntentContent) > 0 {
230+
priority = oldIntentContent[0].GetUpdate().Priority()
231+
}
232+
227233
// store the old intent content in the transaction as the old intent.
228-
err = transaction.AddIntentContent(intent.GetName(), types.TransactionIntentOld, oldIntentContent[0].GetUpdate().Priority(), oldIntentContent, oldExplicitDeletes)
234+
err = transaction.AddIntentContent(intent.GetName(), types.TransactionIntentOld, priority, oldIntentContent, oldExplicitDeletes)
229235
if err != nil {
230236
return nil, err
231237
}

0 commit comments

Comments
 (0)