Bug: Prevent nil pointer panic in deployment metadata updates
Description
UpdateSharedMetadata() and UpdatePluginMetadata() in
pkg/datastore/deploymentstore.go can panic when called with a
deployment whose MetadataV2 field is nil.
Both methods access fields of MetadataV2 without first checking whether
the pointer has been initialized.
Affected Functions
UpdateSharedMetadata()
UpdatePluginMetadata()
File:
pkg/datastore/deploymentstore.go
Current Behavior
When MetadataV2 == nil, calling UpdateSharedMetadata() results in a
nil pointer dereference while accessing:
Bug: Prevent nil pointer panic in deployment metadata updates
Description
UpdateSharedMetadata()andUpdatePluginMetadata()inpkg/datastore/deploymentstore.gocan panic when called with adeployment whose
MetadataV2field is nil.Both methods access fields of
MetadataV2without first checking whetherthe pointer has been initialized.
Affected Functions
UpdateSharedMetadata()UpdatePluginMetadata()File:
pkg/datastore/deploymentstore.goCurrent Behavior
When
MetadataV2 == nil, callingUpdateSharedMetadata()results in anil pointer dereference while accessing: