Skip to content

Commit

Permalink
Fixed index out of range error which can be occur when one of the wor…
Browse files Browse the repository at this point in the history
…ksheet was removed.
  • Loading branch information
kimsama committed May 17, 2016
1 parent 40217a1 commit a5240c9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Assets/QuickSheet/ExcelPlugin/Editor/ExcelMachineEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ Set a folder under the 'Assets' folder! \n
{
// reopen the excel file e.g) new worksheet is added so need to reopen.
machine.SheetNames = new ExcelQuery(machine.excelFilePath).GetSheetNames();

// one of worksheet was removed, so reset the selected worksheet index
// to prevent the index out of range error.
if (machine.SheetNames.Length <= machine.CurrentSheetIndex)
{
machine.CurrentSheetIndex = 0;

string message = "Worksheet was changed. Check the 'Worksheet' and 'Update' it again if it is necessary.";
EditorUtility.DisplayDialog("Info", message, "OK");
}
}
}

Expand Down

0 comments on commit a5240c9

Please sign in to comment.