diff --git a/Models/Stats/TemplateManager.cs b/Models/Stats/TemplateManager.cs index 7dcc1cf..31bea0a 100644 --- a/Models/Stats/TemplateManager.cs +++ b/Models/Stats/TemplateManager.cs @@ -32,7 +32,8 @@ static string JSEvaluator(Match m) { static string? JSEvaluator(string content) { try { return ToNStats.JSEngine.Evaluate(content).ToString(); - } catch (Exception) { + } catch (Exception e) { + Logger.Error(e); return null; } } diff --git a/Utils/LilOSC.cs b/Utils/LilOSC.cs index 7bee157..b99d382 100644 --- a/Utils/LilOSC.cs +++ b/Utils/LilOSC.cs @@ -251,8 +251,8 @@ static float EvaluateDamage(int damage) { string evaluated = Settings.Get.OSCDamageTemplate.GetString(true); float result; - if (!float.TryParse(evaluated, out result)) { - Logger.Debug("Could not evaluate damage: " + evaluated); + if (string.IsNullOrEmpty(evaluated) || !float.TryParse(evaluated, out result)) { + Logger.Error("Could not evaluate damage value: " + evaluated); result = damage; } @@ -263,9 +263,9 @@ static int EvaluateInterval() { string evaluated = Settings.Get.OSCDamageIntervalTemplate.GetString(true); float result; - if (!float.TryParse(evaluated, out result)) { - Logger.Debug("Could not evaluate interval: " + evaluated); - result = 1000; + if (string.IsNullOrEmpty(evaluated) || !float.TryParse(evaluated, out result)) { + Logger.Error("Could not evaluate damage interval: " + evaluated); + result = 500; } else { Logger.Debug("Result Interval: " + result); }