From 4ac515fde468f8d0845ae68fa4416ed4525bce90 Mon Sep 17 00:00:00 2001 From: Richard Date: Fri, 10 Apr 2015 15:56:29 -0700 Subject: [PATCH] Prevent Close() from being called after Finish() --- docs/storage/layerwriter.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/storage/layerwriter.go b/docs/storage/layerwriter.go index ccd8679b..58078459 100644 --- a/docs/storage/layerwriter.go +++ b/docs/storage/layerwriter.go @@ -109,6 +109,10 @@ func (lw *layerWriter) ReadFrom(r io.Reader) (n int64, err error) { } func (lw *layerWriter) Close() error { + if lw.err != nil { + return lw.err + } + if err := lw.storeHashState(); err != nil { return err }