mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-08-19 04:26:45 +00:00
fix: avoiding nil pointer when empty map for labels and annotations
This commit is contained in:
@@ -135,6 +135,14 @@ func (r *userMetadataHandler) OnUpdate(client client.Client, decoder *admission.
|
||||
|
||||
labels, annotations := oldNs.GetLabels(), oldNs.GetAnnotations()
|
||||
|
||||
if labels == nil {
|
||||
labels = make(map[string]string)
|
||||
}
|
||||
|
||||
if annotations == nil {
|
||||
annotations = make(map[string]string)
|
||||
}
|
||||
|
||||
for key, value := range newNs.GetLabels() {
|
||||
v, ok := labels[key]
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user