Skip to content

Commit 46ee1e6

Browse files
fix: nil passport for tests
1 parent 88b4040 commit 46ee1e6

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
@@ -28,17 +28,24 @@ ASWebAuthenticationSession *_authSession;
2828
}
2929

3030
+ (UImmutablePassport*) getPassport {
31-
UWorld* World = nullptr;
32-
3331
#if WITH_EDITOR
3432
if (GEditor)
3533
{
3634
for (const auto& Context : GEditor->GetWorldContexts())
3735
{
38-
if (Context.WorldType == EWorldType::PIE && Context.World())
36+
if (auto* World = Context.World())
3937
{
40-
World = Context.World();
41-
break;
38+
if (auto GameInstance = World->GetGameInstance())
39+
{
40+
if (auto ImmutableSubsystem = GameInstance->GetSubsystem<UImmutableSubsystem>())
41+
{
42+
auto WeakPassport = ImmutableSubsystem->GetPassport();
43+
if (auto Passport = WeakPassport.Get())
44+
{
45+
return Passport;
46+
}
47+
}
48+
}
4249
}
4350
}
4451
}
@@ -49,23 +56,7 @@ ASWebAuthenticationSession *_authSession;
4956
}
5057
#endif
5158

52-
if (!World) {
53-
return nil;
54-
}
55-
56-
auto ImmutableSubsystem = World->GetGameInstance()->GetSubsystem<UImmutableSubsystem>();
57-
58-
if (!ImmutableSubsystem) {
59-
return nil;
60-
}
61-
62-
auto Passport = ImmutableSubsystem->GetPassport();
63-
64-
if (!Passport.IsValid()) {
65-
return nil;
66-
}
67-
68-
return Passport.Get();
59+
return nil;
6960
}
7061

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

0 commit comments

Comments
 (0)