diff options
author | Farmerx <farmerx@163.com> | 2018-08-20 16:53:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-20 16:53:51 +0800 |
commit | ce5b37a4ac93196f90cfef2aec381a9b7d153fdd (patch) | |
tree | 486b0ea4ec16b5c0fca27d9169baaf3b25b42926 /picture.go | |
parent | ec37b114c3b704a84c66fcf3e135c9df88ffb24d (diff) |
# fix : file close 没有关闭
Diffstat (limited to 'picture.go')
-rw-r--r-- | picture.go | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -88,7 +88,11 @@ func (f *File) AddPicture(sheet, cell, picture, format string) error { if !ok { return errors.New("Unsupported image extension") } - readFile, _ := os.Open(picture) + readFile, err := os.Open(picture) + if err!=nil{ + return err + } + defer readFile.Close() image, _, _ := image.DecodeConfig(readFile) _, file := filepath.Split(picture) formatSet, err := parseFormatPictureSet(format) |