Skip to content

Commit

Permalink
Fixed NullReferenceException.
Browse files Browse the repository at this point in the history
The NullReferenceException occurs when the user creates an Excel Tool
(ExcelMachine) asset file before an Excel Setting asset file is created.
  • Loading branch information
zzxiang committed Apr 25, 2018
1 parent d423107 commit 257c2ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions Assets/QuickSheet/ExcelPlugin/Editor/ExcelMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ public int CurrentSheetIndex
/// </summary>

private void Awake() {
// excel and google plugin have its own template files,
// so we need to set the different path when the asset file is created.
TemplatePath = ExcelSettings.Instance.TemplatePath;
if (ExcelSettings.Instance != null)
{
// excel and google plugin have its own template files,
// so we need to set the different path when the asset file is created.
TemplatePath = ExcelSettings.Instance.TemplatePath;
}
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Assets/QuickSheet/ExcelPlugin/Editor/ExcelMachineEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected override void OnEnable()
base.OnEnable();

machine = target as ExcelMachine;
if (machine != null)
if (machine != null && ExcelSettings.Instance != null)
{
if (string.IsNullOrEmpty(ExcelSettings.Instance.RuntimePath) == false)
machine.RuntimeClassPath = ExcelSettings.Instance.RuntimePath;
Expand Down

0 comments on commit 257c2ac

Please sign in to comment.