Make sure that at least one worksheet exist in the workbook

This commit is contained in:
Debao Zhang
2014-01-02 11:45:02 +08:00
parent c6898ff732
commit 5866e1342c
2 changed files with 6 additions and 2 deletions
+2
View File
@@ -251,6 +251,8 @@ bool Workbook::renameWorksheet(int index, const QString &name)
bool Workbook::deleteWorksheet(int index)
{
Q_D(Workbook);
if (d->worksheets.size() <= 1)
return false;
if (index < 0 || index >= d->worksheets.size())
return false;
d->worksheets.removeAt(index);