From 45f78a832bad769932e272f1fbe338a37e71d278 Mon Sep 17 00:00:00 2001 From: mathspanda Date: Wed, 26 Dec 2018 19:39:53 +0800 Subject: [PATCH] Fix nil pointer bug in TaskRun SetDefaults If apply TaskRun CR without TaskRef field, webhook will panic. Signed-off-by: mathspanda --- pkg/apis/pipeline/v1alpha1/taskrun_defaults.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go b/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go index d4a74e37e77..9f36349ba10 100644 --- a/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go +++ b/pkg/apis/pipeline/v1alpha1/taskrun_defaults.go @@ -21,7 +21,7 @@ func (tr *TaskRun) SetDefaults() { } func (trs *TaskRunSpec) SetDefaults() { - if trs.TaskRef.Kind == "" { + if trs.TaskRef != nil && trs.TaskRef.Kind == "" { trs.TaskRef.Kind = NamespacedTaskKind } }