Skip to content

Commit

Permalink
Fix potential nil pointer dereference.
Browse files Browse the repository at this point in the history
  • Loading branch information
fenxiong committed Aug 19, 2020
1 parent 65cde1f commit a21516a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions agent/stats/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,8 +776,9 @@ func (engine *DockerStatsEngine) ContainerDockerStats(taskARN string, containerI
if task.IsNetworkModeAWSVPC() {
taskStats, ok := taskToTaskStats[taskARN]
if ok {
taskNetworkStats := taskStats.StatsQueue.GetLastStat().Networks
containerStats.Networks = taskNetworkStats
if taskStats.StatsQueue.GetLastStat() != nil {
containerStats.Networks = taskStats.StatsQueue.GetLastStat().Networks
}
containerNetworkRateStats = taskStats.StatsQueue.GetLastNetworkStatPerSec()
} else {
seelog.Warnf("Network stats not found for container %s", containerID)
Expand Down

0 comments on commit a21516a

Please sign in to comment.