Skip to content

Commit

Permalink
Fix a possible nil map access
Browse files Browse the repository at this point in the history
  • Loading branch information
shashidharatd committed Aug 9, 2018
1 parent ec65335 commit a50a306
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions registry/txt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a50a306

Please sign in to comment.