fix potential nil pointer

This commit is contained in:
yuzhiquan 2021-04-26 15:31:34 +08:00
parent ee2c3c1859
commit d483872d64

View File

@ -292,7 +292,7 @@ func (g *GenericPLEG) relist() {
} }
} }
if containerID, ok := events[i].Data.(string); ok { if containerID, ok := events[i].Data.(string); ok {
if exitCode, ok := containerExitCode[containerID]; ok { if exitCode, ok := containerExitCode[containerID]; ok && pod != nil {
klog.V(2).InfoS("Generic (PLEG): container finished", "podID", pod.ID, "containerID", containerID, "exitCode", exitCode) klog.V(2).InfoS("Generic (PLEG): container finished", "podID", pod.ID, "containerID", containerID, "exitCode", exitCode)
} }
} }