From 22e1868ab5fd6be77edd7c13698c45c1aff8de78 Mon Sep 17 00:00:00 2001 From: mensong Date: Fri, 3 Nov 2023 10:35:19 +0800 Subject: [PATCH] fix:copy_sheet index>sheetcount error --- source/workbook/workbook.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/workbook/workbook.cpp b/source/workbook/workbook.cpp index 2e30e05c..437f3f42 100644 --- a/source/workbook/workbook.cpp +++ b/source/workbook/workbook.cpp @@ -823,6 +823,9 @@ worksheet workbook::copy_sheet(worksheet to_copy) worksheet workbook::copy_sheet(worksheet to_copy, std::size_t index) { + if (index > d_->worksheets_.size()) + throw invalid_parameter(); + copy_sheet(to_copy); if (index != d_->worksheets_.size() - 1)