Skip to content

Commit

Permalink
Fixed logic error in book_append_sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
ingfraga committed Aug 2, 2020
1 parent 78b0119 commit 554d300
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bits/95_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ utils.book_new = function()/*:Workbook*/ {

/* add a worksheet to the end of a given workbook */
utils.book_append_sheet = function(wb/*:Workbook*/, ws/*:Worksheet*/, name/*:?string*/) {
if(!name) for(var i = 1; i <= 0xFFFF; ++i) if(wb.SheetNames.indexOf(name = "Sheet" + i) == -1) break;
if(!name) throw new Error("Too many worksheets");
if(!name) for(var i = 1; i <= 0xFFFF; ++i, name = undefined) if(wb.SheetNames.indexOf(name = "Sheet" + i) == -1) break;
if(!name || wb.SheetNames.length >= 0xFFFF) throw new Error("Too many worksheets");
check_ws_name(name);
if(wb.SheetNames.indexOf(name) >= 0) throw new Error("Worksheet with name |" + name + "| already exists!");

Expand Down
2 changes: 1 addition & 1 deletion xlsx.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 554d300

Please sign in to comment.