Skip to content

Commit

Permalink
Fix potential nil error in generator
Browse files Browse the repository at this point in the history
Fix potential nil error in generator if attempting to update JSON schema
for a field that has the 'endpoints' property but isn't a
ContainerComponent (e.g. a Pod spec).

Signed-off-by: Angel Misevski <[email protected]>
  • Loading branch information
amisevsk committed Sep 19, 2022
1 parent 0d50b8c commit 98f8c77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion generator/schemas/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ This is not the case in the "%s' API group:
return
}
for propName, prop := range schema.Properties {
if propName == "endpoints" {
if propName == "endpoints" && prop.Items != nil && prop.Items.Schema != nil {
for endpointPropName, endpointProp := range prop.Items.Schema.Properties {
if endpointPropName == "name" {
if schemaGenerateMarker.ShortenEndpointNameLength {
Expand Down

0 comments on commit 98f8c77

Please sign in to comment.