Remove redundant `len` check in `GroupSheets` and `UngroupSheets` (#1685)

This commit is contained in:
Eng Zer Jun 2023-10-12 09:23:31 +08:00 committed by GitHub
parent d9a0da7b48
commit f752f2ddf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 9 deletions

View File

@ -1739,11 +1739,8 @@ func (f *File) GroupSheets(sheets []string) error {
}
for _, ws := range wss {
sheetViews := ws.SheetViews.SheetView
if len(sheetViews) > 0 {
for idx := range sheetViews {
ws.SheetViews.SheetView[idx].TabSelected = true
}
continue
for idx := range sheetViews {
ws.SheetViews.SheetView[idx].TabSelected = true
}
}
return nil
@ -1758,10 +1755,8 @@ func (f *File) UngroupSheets() error {
}
ws, _ := f.workSheetReader(sheet)
sheetViews := ws.SheetViews.SheetView
if len(sheetViews) > 0 {
for idx := range sheetViews {
ws.SheetViews.SheetView[idx].TabSelected = false
}
for idx := range sheetViews {
ws.SheetViews.SheetView[idx].TabSelected = false
}
}
return nil