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)