From c3e92a51d744bc8420e0626b06ee3a0efd030341 Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 14 Aug 2020 16:09:50 +0000 Subject: Compatible with Go 1.15, fix unit test failed on Windows and fixed #689 potential race condition --- rows.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'rows.go') diff --git a/rows.go b/rows.go index 320ba2f..66dd16b 100644 --- a/rows.go +++ b/rows.go @@ -284,6 +284,8 @@ func (f *File) GetRowHeight(sheet string, row int) (float64, error) { func (f *File) sharedStringsReader() *xlsxSST { var err error + f.Lock() + defer f.Unlock() if f.SharedStrings == nil { var sharedStrings xlsxSST ss := f.readXML("xl/sharedStrings.xml") @@ -318,6 +320,8 @@ func (f *File) sharedStringsReader() *xlsxSST { // inteded to be used with for range on rows an argument with the xlsx opened // file. func (xlsx *xlsxC) getValueFrom(f *File, d *xlsxSST) (string, error) { + f.Lock() + defer f.Unlock() switch xlsx.T { case "s": if xlsx.V != "" { -- cgit v1.2.1