From fdf8414a45c7c9c7a04dccd4df09840c3295e952 Mon Sep 17 00:00:00 2001 From: shashidharatd Date: Wed, 1 Aug 2018 22:03:21 +0530 Subject: [PATCH] Fix a possible nil map access --- registry/txt.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/registry/txt.go b/registry/txt.go index a75b4afaac..e1f51d8533 100644 --- a/registry/txt.go +++ b/registry/txt.go @@ -125,6 +125,9 @@ func (im *TXTRegistry) ApplyChanges(changes *plan.Changes) error { Delete: filterOwnedRecords(im.ownerID, changes.Delete), } for _, r := range filteredChanges.Create { + if r.Labels == nil { + r.Labels = make(map[string]string) + } r.Labels[endpoint.OwnerLabelKey] = im.ownerID txt := endpoint.NewEndpoint(im.mapper.toTXTName(r.DNSName), endpoint.RecordTypeTXT, r.Labels.Serialize(true)) filteredChanges.Create = append(filteredChanges.Create, txt)