Skip to content

Commit 6b8204f

Browse files
authored
[PipeCD-DataStore] fix: nil pointer dereference in UpdatePluginMetadata (#6611)
Signed-off-by: Hoang Ngo <adlehoang118@gmail.com>
1 parent ae120b8 commit 6b8204f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/datastore/deploymentstore.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ func (s *deploymentStore) UpdatePluginMetadata(ctx context.Context, id string, p
264264
if d.MetadataV2.Plugins == nil {
265265
d.MetadataV2.Plugins = make(map[string]*model.DeploymentMetadata_KeyValues)
266266
}
267+
if d.MetadataV2.Plugins[pluginName] == nil {
268+
d.MetadataV2.Plugins[pluginName] = &model.DeploymentMetadata_KeyValues{}
269+
}
267270
d.MetadataV2.Plugins[pluginName] = &model.DeploymentMetadata_KeyValues{
268271
KeyValues: mergeMetadata(d.MetadataV2.Plugins[pluginName].KeyValues, metadata),
269272
}

0 commit comments

Comments
 (0)