Fix possible nil pointer dereference (#13318)

This commit is contained in:
Eugene R 2021-12-02 15:23:41 +02:00 committed by GitHub
parent f0f4c2886a
commit c2a92cd351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

3
changelog/13318.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
identity: Fix possible nil pointer dereference.
```

View File

@ -250,8 +250,9 @@ func (i *IdentityStore) Invalidate(ctx context.Context, key string) {
// storage entry is non-nil, its an indication of an update. In this
// case, entities in the updated bucket needs to be reinserted into
// MemDB.
entityIDs := make([]string, 0, len(bucket.Items))
var entityIDs []string
if bucket != nil {
entityIDs = make([]string, 0, len(bucket.Items))
for _, item := range bucket.Items {
entity, err := i.parseEntityFromBucketItem(ctx, item)
if err != nil {