Skip to content

Commit 94ab7cd

Browse files
fix: passport is nil for automated tests
1 parent 2410ba7 commit 94ab7cd

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

Source/Immutable/Private/Immutable/Mac/ImmutableMac.cpp

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,24 @@ static NSString* _pendingRedirectScheme = nil;
3232
}
3333

3434
+ (UImmutablePassport*) getPassport {
35-
UWorld* World = nullptr;
36-
3735
#if WITH_EDITOR
3836
if (GEditor)
3937
{
4038
for (const auto& Context : GEditor->GetWorldContexts())
4139
{
42-
if (Context.WorldType == EWorldType::PIE && Context.World())
40+
if (auto* World = Context.World())
4341
{
44-
World = Context.World();
45-
break;
42+
if (auto GameInstance = World->GetGameInstance())
43+
{
44+
if (auto ImmutableSubsystem = GameInstance->GetSubsystem<UImmutableSubsystem>())
45+
{
46+
auto WeakPassport = ImmutableSubsystem->GetPassport();
47+
if (auto Passport = WeakPassport.Get())
48+
{
49+
return Passport;
50+
}
51+
}
52+
}
4653
}
4754
}
4855
}
@@ -53,23 +60,7 @@ static NSString* _pendingRedirectScheme = nil;
5360
}
5461
#endif
5562

56-
if (!World) {
57-
return nil;
58-
}
59-
60-
auto ImmutableSubsystem = World->GetGameInstance()->GetSubsystem<UImmutableSubsystem>();
61-
62-
if (!ImmutableSubsystem) {
63-
return nil;
64-
}
65-
66-
auto Passport = ImmutableSubsystem->GetPassport();
67-
68-
if (!Passport.IsValid()) {
69-
return nil;
70-
}
71-
72-
return Passport.Get();
63+
return nil;
7364
}
7465

7566
- (void)launchUrl:(const char *)url forRedirectUri:(const char *)redirectUri {

0 commit comments

Comments
 (0)