Skip to content

Commit 164b105

Browse files
committed
Fix on-start crash on Unreal 5.3
1 parent 2e86bd2 commit 164b105

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Source/BetaHubBugReporter/Private/BH_Manager.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ void UBH_Manager::StartService(UGameInstance* GI)
1515
return;
1616
}
1717

18+
// print log GI pointer value
19+
UE_LOG(LogBetaHub, Log, TEXT("GI pointer value: %p"), GI);
20+
21+
if (GI == nullptr)
22+
{
23+
// try to get the game instance from the world
24+
GI = GetWorld()->GetGameInstance();
25+
26+
if (GI == nullptr)
27+
{
28+
UE_LOG(LogBetaHub, Error, TEXT("Game instance not found."));
29+
return;
30+
}
31+
}
32+
1833
GI->OnLocalPlayerAddedEvent.AddUObject(this, &UBH_Manager::OnLocalPlayerAdded);
1934

2035
BackgroundService = NewObject<UBH_BackgroundService>(this);

0 commit comments

Comments
 (0)