diff --git a/cmd/cover/html.go b/cmd/cover/html.go
index f6b22640..ef50e2bf 100644
--- a/cmd/cover/html.go
+++ b/cmd/cover/html.go
@@ -67,6 +67,9 @@ func htmlOutput(profile, outfile string) error {
} else {
out, err = os.Create(outfile)
}
+ if err != nil {
+ return err
+ }
err = htmlTemplate.Execute(out, d)
if err == nil {
err = out.Close()