Fix crash in Docker input plugin - Fixes #1195

Commit fixes crash in Docker input plugin caused by the fact that return value
might be nil when error occurs.

closes #1195
This commit is contained in:
Zdenek Styblik
2016-05-15 11:19:53 +00:00
committed by Cameron Sparr
parent 08ecfb8a67
commit 39df2635bd
2 changed files with 3 additions and 1 deletions

View File

@@ -221,7 +221,7 @@ func (d *Docker) gatherContainer(
defer cancel()
r, err := d.client.ContainerStats(ctx, container.ID, false)
if err != nil {
log.Printf("Error getting docker stats: %s\n", err.Error())
return fmt.Errorf("Error getting docker stats: %s", err.Error())
}
defer r.Close()
dec := json.NewDecoder(r)