From 4553965d9c4a8d99bd0d381c1180c08e07eff5fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Reigota?= Date: Tue, 1 Feb 2022 10:03:03 +0000 Subject: [PATCH] fix(decompresser_zip): fix panic when decompressing protected zip file (#343) (#344) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Reigota --- decompress_zip.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/decompress_zip.go b/decompress_zip.go index 4876a3374..943610aee 100644 --- a/decompress_zip.go +++ b/decompress_zip.go @@ -74,7 +74,9 @@ func (d *ZipDecompressor) Decompress(dst, src string, dir bool, umask os.FileMod // Open the file for reading srcF, err := f.Open() if err != nil { - srcF.Close() + if srcF != nil { + srcF.Close() + } return err }