Skip to content

Commit

Permalink
fix(LogGUI): fixing exception in find all loggers for generic types
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Frowen committed Oct 2, 2021
1 parent d4c40fc commit 6221965
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Assets/Mirage/Editor/Logging/LogLevelsGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,17 @@ private void DrawFindAllButton()

foreach (FieldInfo field in type.GetFields(flags))
{
if (field.IsStatic && field.FieldType == typeof(ILogger))
try
{
var value = (ILogger)field.GetValue(null);
AddIfMissing(type, value);
if (field.IsStatic && field.FieldType == typeof(ILogger))
{
var value = (ILogger)field.GetValue(null);
AddIfMissing(type, value);
}
}
catch (Exception e)
{
Debug.LogError($"Failed to find Logger inside type {type.Name} with exception:{e}");
}
}
}
Expand Down

0 comments on commit 6221965

Please sign in to comment.