Failsafe for null reference
This commit is contained in:
parent
f1b58b8885
commit
046e07edc6
1 changed files with 7 additions and 0 deletions
|
|
@ -74,6 +74,13 @@ public class Logger
|
|||
|
||||
foreach (var b in _loggerObjects.LogsToPost.ToList())
|
||||
{
|
||||
if (b is null || b.Message is "" || b.TimeOfEvent != new DateTime())
|
||||
{
|
||||
LogWarn(null, $"Missed log message due to missing data");
|
||||
_loggerObjects.LogsToPost.Remove(b);
|
||||
continue;
|
||||
}
|
||||
|
||||
string LogLevelText = b.LogLevel.ToString();
|
||||
ConsoleColor LogLevelColor = ConsoleColor.Gray;
|
||||
|
||||
|
|
|
|||
Reference in a new issue