From 2f6287a45dedc6a6a0bb2cb60e9437af411c10f9 Mon Sep 17 00:00:00 2001 From: Gilbert Chen Date: Thu, 5 Oct 2017 22:22:55 -0400 Subject: [PATCH] readCloser may be nil if the file to be searched doesn't exist --- src/duplicacy_b2client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/duplicacy_b2client.go b/src/duplicacy_b2client.go index e889e5e..af92979 100644 --- a/src/duplicacy_b2client.go +++ b/src/duplicacy_b2client.go @@ -335,7 +335,9 @@ func (client *B2Client) ListFileNames(startFileName string, singleFile bool, inc return nil, err } - defer readCloser.Close() + if readCloser != nil { + defer readCloser.Close() + } output := B2ListFileNamesOutput{}