From 2524f300dcd381cd6cdedf20b001d690924e1500 Mon Sep 17 00:00:00 2001 From: Sylvain Baubeau Date: Tue, 30 Jun 2015 14:23:26 +0200 Subject: [PATCH] Check file has been opened before closing it Signed-off-by: Sylvain Baubeau --- docs/storage/driver/swift/swift.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/storage/driver/swift/swift.go b/docs/storage/driver/swift/swift.go index f91af9081..dd7238c21 100644 --- a/docs/storage/driver/swift/swift.go +++ b/docs/storage/driver/swift/swift.go @@ -312,12 +312,12 @@ func (d *driver) WriteStream(ctx context.Context, path string, offset int64, rea // Offset is inside the current segment : we need to read the // data from the beginning of the segment to offset file, _, err := d.Conn.ObjectOpen(d.Container, getSegment(), false, nil) - defer file.Close() - paddingReader = file - if err != nil { return 0, parseError(getSegment(), err) } + + defer file.Close() + paddingReader = file } readers := []io.Reader{}