From f71e851ab5e50000f06b03c2b52c8c8e9a0c46e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Mon, 14 Aug 2023 22:09:17 +0200 Subject: [PATCH] Push Loggers earlyer to hopefully avoid race condition + Fix null check in EditorLogger --- GlitchyEditor/src/EditorApp.bf | 4 ++-- GlitchyEditor/src/EditorLogger.bf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GlitchyEditor/src/EditorApp.bf b/GlitchyEditor/src/EditorApp.bf index dba63b0..9e8529f 100644 --- a/GlitchyEditor/src/EditorApp.bf +++ b/GlitchyEditor/src/EditorApp.bf @@ -11,10 +11,10 @@ namespace GlitchyEditor public this(String[] args) { - PushLayer(new EditorLayer(args, _contentManager)); - Log.ClientLogger = new EditorLogger(); Log.EngineLogger = new EditorLogger() { IsEngineLogger = true }; + + PushLayer(new EditorLayer(args, _contentManager)); } protected override IContentManager InitContentManager() diff --git a/GlitchyEditor/src/EditorLogger.bf b/GlitchyEditor/src/EditorLogger.bf index 51ed313..130fdeb 100644 --- a/GlitchyEditor/src/EditorLogger.bf +++ b/GlitchyEditor/src/EditorLogger.bf @@ -113,7 +113,7 @@ public class EditorLogger : Logger Debug.Write($"[{timestamp:HH:mm:ss.fff}] ({_name})|{level.UpperString}: {message}\n"); - if (Editor.Instance == null) + if (Editor.Instance?.LogWindow == null) return; if (args.Count > 0 && (var ex = args[^1] as MonoExceptionHelper))