Skip to content

Commit f6dd767

Browse files
authored
Fixes the bug that ToACKTags function does not handle an edge case. (#374)
Issue [#1549](aws-controllers-k8s/community#1549) Description of changes: - Avoids panic code when customer provides a tag with nil key and nil value. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent a6a8a09 commit f6dd767

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

templates/pkg/resource/tags.go.tpl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ func ToACKTags(tags {{ $tagFieldGoType }}) acktags.Tags {
4646
}
4747
{{ else if eq "list" $tagFieldShapeType }}
4848
for _, t := range tags {
49-
if t.{{ $valueMemberName }} == nil {
50-
result[*t.{{ $keyMemberName}}] = ""
51-
} else {
52-
result[*t.{{ $keyMemberName }}] = *t.{{ $valueMemberName }}
49+
if t.{{ $keyMemberName}} != nil {
50+
if t.{{ $valueMemberName }} == nil {
51+
result[*t.{{ $keyMemberName}}] = ""
52+
} else {
53+
result[*t.{{ $keyMemberName }}] = *t.{{ $valueMemberName }}
54+
}
5355
}
5456
}
5557
{{ end }}

0 commit comments

Comments
 (0)