From 600269f681dabd51eb961e176d9b2bd5c9a2959f Mon Sep 17 00:00:00 2001 From: Martin Martinez Rivera Date: Mon, 4 Nov 2024 11:52:40 -0800 Subject: [PATCH 1/2] Fix panic --- rows.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rows.go b/rows.go index d43a015040..40004e7363 100644 --- a/rows.go +++ b/rows.go @@ -295,7 +295,13 @@ func (f *File) getFromStringItem(index int) string { if len(f.sharedStringItem) <= index { return strconv.Itoa(index) } + if len(f.sharedStringItem) < index+1 { + return "" + } offsetRange := f.sharedStringItem[index] + if len(offsetRange) < 2 { + return "" + } buf := make([]byte, offsetRange[1]-offsetRange[0]) if _, err := f.sharedStringTemp.ReadAt(buf, int64(offsetRange[0])); err != nil { return strconv.Itoa(index) From d9e02e8ac9b7eadef5f839292daa5659c7df9590 Mon Sep 17 00:00:00 2001 From: Martin Martinez Rivera Date: Mon, 4 Nov 2024 11:56:30 -0800 Subject: [PATCH 2/2] remove if --- rows.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/rows.go b/rows.go index 40004e7363..f5f2dad603 100644 --- a/rows.go +++ b/rows.go @@ -295,9 +295,6 @@ func (f *File) getFromStringItem(index int) string { if len(f.sharedStringItem) <= index { return strconv.Itoa(index) } - if len(f.sharedStringItem) < index+1 { - return "" - } offsetRange := f.sharedStringItem[index] if len(offsetRange) < 2 { return ""