Skip to content
Permalink
Browse files

Merge pull request #153 from yue9944882/bugfix/nil-panic-on-info-log

Fixes nil panic on unknown types
  • Loading branch information...
k8s-ci-robot committed Sep 7, 2019
2 parents a874a24 + 291e400 commit ebc107f98eab922ef99d645781b87caca01f4f48
Showing with 5 additions and 1 deletion.
  1. +5 −1 examples/defaulter-gen/generators/defaulter.go
@@ -248,7 +248,11 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
shouldCreateObjectDefaulterFn := func(t *types.Type) bool {
if defaults, ok := existingDefaulters[t]; ok && defaults.object != nil {
// A default generator is defined
klog.V(5).Infof(" an object defaulter already exists as %s", defaults.base.Name)
baseTypeName := "<unknown>"
if defaults.base != nil {
baseTypeName = defaults.base.Name.String()
}
klog.V(5).Infof(" an object defaulter already exists as %s", baseTypeName)
return false
}
// opt-out

0 comments on commit ebc107f

Please sign in to comment.
You can’t perform that action at this time.