From 6a1a3901d4fd1c45f9864a067a59c7d29fa8a582 Mon Sep 17 00:00:00 2001 From: Arnaud Jamin Date: Fri, 7 Feb 2025 09:41:17 -0500 Subject: [PATCH] CogEngine: Fix crash related to log and notification --- .../CogEngine/Private/CogEngineWindow_Notifications.cpp | 7 +++++-- .../Source/CogEngine/Private/CogEngineWindow_OutputLog.cpp | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Notifications.cpp b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Notifications.cpp index 914d5a3..3710fff 100644 --- a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Notifications.cpp +++ b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Notifications.cpp @@ -14,9 +14,9 @@ void FCogEngineWindow_Notifications::Initialize() { Super::Initialize(); - OutputDevice.Notifications = this; - Config = GetConfig(); + + OutputDevice.Notifications = this; } //-------------------------------------------------------------------------------------------------------------------------- @@ -46,6 +46,9 @@ void FCogEngineWindow_Notifications::AddNotification(const TCHAR* InMessage, ELo //-------------------------------------------------------------------------------------------------------------------------- void FCogEngineWindow_Notifications::OnLogReceived(const TCHAR* InMessage, ELogVerbosity::Type InVerbosity, const class FName& InCategory) { + if (Config == nullptr) + { return; } + if (Config->DisableNotifications) { return; } diff --git a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_OutputLog.cpp b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_OutputLog.cpp index 76830a5..a2c6071 100644 --- a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_OutputLog.cpp +++ b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_OutputLog.cpp @@ -51,7 +51,7 @@ void FCogEngineWindow_OutputLog::AddLog(const TCHAR* InMessage, ELogVerbosity::T FLogInfo& LogInfo = LogInfos.AddDefaulted_GetRef(); LogInfo.Frame = GFrameCounter; - LogInfo.Time = Config->UseUTCTime ? FDateTime::UtcNow() : FDateTime::Now(); + LogInfo.Time = Config != nullptr && Config->UseUTCTime ? FDateTime::UtcNow() : FDateTime::Now(); LogInfo.Verbosity = InVerbosity; LogInfo.Category = InCategory; LogInfo.LineStart = TextBuffer.size();