mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
The function shouldRecordEvent will panic when the value of input object is nil
This commit is contained in:
@@ -191,10 +191,11 @@ type innerEventRecorder struct {
|
||||
}
|
||||
|
||||
func (irecorder *innerEventRecorder) shouldRecordEvent(object runtime.Object) (*v1.ObjectReference, bool) {
|
||||
if object == nil {
|
||||
return nil, false
|
||||
}
|
||||
if ref, ok := object.(*v1.ObjectReference); ok {
|
||||
// this check is needed AFTER the cast. See https://github.com/kubernetes/kubernetes/issues/95552
|
||||
if ref == nil {
|
||||
return nil, false
|
||||
}
|
||||
if !strings.HasPrefix(ref.FieldPath, ImplicitContainerPrefix) {
|
||||
return ref, true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user