Skip to content

Commit

Permalink
Merge pull request #2818 from CombatExtended-Continued/fixdebug
Browse files Browse the repository at this point in the history
Add try/catch around iterating all methods
  • Loading branch information
N7Huntsman authored Oct 23, 2023
2 parents 111a5c7 + 9163354 commit 3b01b08
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Source/CombatExtended/CombatExtended/CE_DebugTooltipHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,17 @@ static CE_DebugTooltipHelper()
var functions = typeof(CE_DebugTooltipHelper).Assembly
.GetTypes()
.SelectMany(t => t.GetMethods(AccessTools.all))
.Where(m => m.HasAttribute<CE_DebugTooltip>() && m.IsStatic);
.Where(m =>
{
try
{
return m.HasAttribute<CE_DebugTooltip>() && m.IsStatic;
}
catch (System.Reflection.TargetInvocationException)
{
return false;
}
});
foreach (MethodBase m in functions)
{
CE_DebugTooltip attribute = m.TryGetAttribute<CE_DebugTooltip>();
Expand Down

0 comments on commit 3b01b08

Please sign in to comment.