From 40ed10cc32fe6dbf18d13a43d42a1a9bed0df902 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Thu, 31 Oct 2013 18:39:44 -0700 Subject: [PATCH] fix inspect when it returns nothing valid --- commands.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/commands.go b/commands.go index 0e06f47947..05c8b6bb04 100644 --- a/commands.go +++ b/commands.go @@ -667,9 +667,11 @@ func (cli *DockerCli) CmdInspect(args ...string) error { } indented.WriteString(",") } - // Remove trailling ',' - indented.Truncate(indented.Len() - 1) + if indented.Len() > 0 { + // Remove trailling ',' + indented.Truncate(indented.Len() - 1) + } fmt.Fprintf(cli.out, "[") if _, err := io.Copy(cli.out, indented); err != nil { return err