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 1, 2018
1 parent f3d0f32 commit fdf8414
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 fdf8414

Please sign in to comment.