From 6fcb1ba194a911e045d8ad4c5b033c31a236cc57 Mon Sep 17 00:00:00 2001
From: jehret <ehret@vr.rwth-aachen.de>
Date: Wed, 15 Nov 2023 15:38:55 +0100
Subject: [PATCH] minor fix to avoid problems when running on "unrelated maps"

---
 Source/StudyFrameworkPlugin/Private/SFGameInstance.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Source/StudyFrameworkPlugin/Private/SFGameInstance.cpp b/Source/StudyFrameworkPlugin/Private/SFGameInstance.cpp
index 4670399..b44599d 100644
--- a/Source/StudyFrameworkPlugin/Private/SFGameInstance.cpp
+++ b/Source/StudyFrameworkPlugin/Private/SFGameInstance.cpp
@@ -818,8 +818,12 @@ USFLogObject* USFGameInstance::GetLogObject()
 
 void USFGameInstance::LogComment(const FString& Comment, bool bAlsoLogToHUD /*= true*/)
 {
-	UniLog.Log("#" + GetParticipant()->GetCurrentTimeAsString() + ": " + Comment, "ParticipantLog");
 	FSFLoggingUtils::Log("Logged Comment: " + Comment);
+	if (!GetParticipant())
+	{
+		return;
+	}
+	UniLog.Log("#" + GetParticipant()->GetCurrentTimeAsString() + ": " + Comment, "ParticipantLog");
 	if (bAlsoLogToHUD)
 	{
 		LogToHUD(Comment);
-- 
GitLab