Skip to content

Commit 5c5b89b

Browse files
fix: nil passport for tests
1 parent 8ab2e4f commit 5c5b89b

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
@@ -31,17 +31,24 @@ static NSString* _pendingRedirectScheme = nil;
3131
}
3232

3333
+ (UImmutablePassport*) getPassport {
34-
UWorld* World = nullptr;
35-
3634
#if WITH_EDITOR
3735
if (GEditor)
3836
{
3937
for (const auto& Context : GEditor->GetWorldContexts())
4038
{
41-
if (Context.WorldType == EWorldType::PIE && Context.World())
39+
if (auto* World = Context.World())
4240
{
43-
World = Context.World();
44-
break;
41+
if (auto GameInstance = World->GetGameInstance())
42+
{
43+
if (auto ImmutableSubsystem = GameInstance->GetSubsystem<UImmutableSubsystem>())
44+
{
45+
auto WeakPassport = ImmutableSubsystem->GetPassport();
46+
if (auto Passport = WeakPassport.Get())
47+
{
48+
return Passport;
49+
}
50+
}
51+
}
4552
}
4653
}
4754
}
@@ -52,23 +59,7 @@ static NSString* _pendingRedirectScheme = nil;
5259
}
5360
#endif
5461

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

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

0 commit comments

Comments
 (0)