Even more safety

This commit is contained in:
Steve Streeting 2020-11-23 12:52:55 +00:00
parent 38d126ac64
commit 4c22341052

View File

@ -20,10 +20,11 @@ public:
inline UStevesGameSubsystem* GetStevesGameSubsystem(UWorld* WorldContext) inline UStevesGameSubsystem* GetStevesGameSubsystem(UWorld* WorldContext)
{ {
if (IsValid(WorldContext) && IsValid(WorldContext->GetGameInstance()) && if (IsValid(WorldContext) && WorldContext->IsGameWorld())
WorldContext->IsGameWorld())
{ {
return WorldContext->GetGameInstance()->GetSubsystem<UStevesGameSubsystem>(); auto GI = WorldContext->GetGameInstance();
if (IsValid(GI))
return GI->GetSubsystem<UStevesGameSubsystem>();
} }
return nullptr; return nullptr;