Update ServiceMain.cs
Some checks are pending
CodeQL / Analyze (csharp) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run

This commit is contained in:
Namhyeon Go 2024-07-22 20:36:34 +09:00
parent d758957d68
commit 360d37cd36

View File

@ -97,7 +97,7 @@ namespace WelsonJS.Service
}
catch (Exception ex)
{
Log("Exception: " + ex.Message);
Log("Exception when start: " + ex.Message);
}
}
else
@ -121,11 +121,14 @@ namespace WelsonJS.Service
try
{
InvokeScriptMethod("initializeService", scriptName, "stop");
scriptControl.Reset();
if (scriptControl != null)
{
scriptControl.Reset();
}
}
catch (Exception ex)
{
Log("Exception: " + ex.Message);
Log("Exception when stop: " + ex.Message);
}
scriptControl = null;
@ -140,13 +143,21 @@ namespace WelsonJS.Service
}
catch (Exception ex)
{
Log("Exception: " + ex.Message);
Log("Exception when elapsed time: " + ex.Message);
}
}
private string InvokeScriptMethod(string methodName, params object[] parameters)
{
return scriptControl.Run(methodName, parameters).ToString();
if (scriptControl != null)
{
return scriptControl.Run(methodName, parameters).ToString();
}
else
{
Log("InvokeScriptMethod Ignored: " + methodName);
return null;
}
}
private void Log(string message)