CogEngine: Fix crash related to log and notification

This commit is contained in:
Arnaud Jamin
2025-02-07 09:41:17 -05:00
parent 1e27fc0c13
commit 6a1a3901d4
2 changed files with 6 additions and 3 deletions
@@ -14,9 +14,9 @@ void FCogEngineWindow_Notifications::Initialize()
{ {
Super::Initialize(); Super::Initialize();
OutputDevice.Notifications = this;
Config = GetConfig<UCogEngineConfig_Notifications>(); Config = GetConfig<UCogEngineConfig_Notifications>();
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) void FCogEngineWindow_Notifications::OnLogReceived(const TCHAR* InMessage, ELogVerbosity::Type InVerbosity, const class FName& InCategory)
{ {
if (Config == nullptr)
{ return; }
if (Config->DisableNotifications) if (Config->DisableNotifications)
{ return; } { return; }
@@ -51,7 +51,7 @@ void FCogEngineWindow_OutputLog::AddLog(const TCHAR* InMessage, ELogVerbosity::T
FLogInfo& LogInfo = LogInfos.AddDefaulted_GetRef(); FLogInfo& LogInfo = LogInfos.AddDefaulted_GetRef();
LogInfo.Frame = GFrameCounter; 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.Verbosity = InVerbosity;
LogInfo.Category = InCategory; LogInfo.Category = InCategory;
LogInfo.LineStart = TextBuffer.size(); LogInfo.LineStart = TextBuffer.size();