Skip to content

Commit

Permalink
Fixed crash on 'stop' simulation button with dirty assets
Browse files Browse the repository at this point in the history
  • Loading branch information
JanSeliv committed Dec 29, 2023
1 parent fa511d5 commit 699fd08
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
Binary file modified Binaries/Win64/UnrealEditor-PoolManager.dll
Binary file not shown.
Binary file modified Binaries/Win64/UnrealEditor-PoolManager.pdb
Binary file not shown.
27 changes: 11 additions & 16 deletions Source/PoolManager/Private/PoolManagerSubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,21 @@ UPoolManagerSubsystem* UPoolManagerSubsystem::GetPoolManagerByClass(TSubclassOf<
OptionalClass = StaticClass();
}

const UWorld* FoundWorld = OptionalWorldContext
? GEngine->GetWorldFromContextObject(OptionalWorldContext, EGetWorldErrorMode::Assert)
: GEngine->GetCurrentPlayWorld();

const UWorld* World = OptionalWorldContext
? GEngine->GetWorldFromContextObject(OptionalWorldContext, EGetWorldErrorMode::ReturnNull)
: GEngine->GetCurrentPlayWorld();
#if WITH_EDITOR
if (!FoundWorld && GEditor)
{
// If world is not found, most likely a game did not start yet and we are in editor
const FWorldContext& WorldContext = GEditor->IsPlaySessionInProgress() ? *GEditor->GetPIEWorldContext() : GEditor->GetEditorWorldContext();
FoundWorld = WorldContext.World();
}
#endif // WITH_EDITOR

if (!ensureMsgf(FoundWorld, TEXT("%s: Can not obtain current world"), *FString(__FUNCTION__)))
if (!World && GIsEditor && GEditor)
{
return nullptr;
World = GEditor->IsPlaySessionInProgress()
? (GEditor->GetCurrentPlayWorld() ? GEditor->GetCurrentPlayWorld() : (GEditor->GetPIEWorldContext() ? GEditor->GetPIEWorldContext()->World() : nullptr))
: GEditor->GetEditorWorldContext().World();
World = World ? World : GWorld;
}
#endif

UPoolManagerSubsystem* FoundPoolManager = Cast<UPoolManagerSubsystem>(FoundWorld->GetSubsystemBase(OptionalClass));
if (!ensureMsgf(FoundPoolManager, TEXT("%s: 'Can not find Pool Manager for %s class in %s world"), *FString(__FUNCTION__), *OptionalClass->GetName(), *FoundWorld->GetName()))
UPoolManagerSubsystem* FoundPoolManager = World ? Cast<UPoolManagerSubsystem>(World->GetSubsystemBase(OptionalClass)) : nullptr;
if (!ensureMsgf(FoundPoolManager, TEXT("%s: 'Can not find Pool Manager for %s class in %s world"), *FString(__FUNCTION__), *OptionalClass->GetName(), *World->GetName()))
{
return nullptr;
}
Expand Down

0 comments on commit 699fd08

Please sign in to comment.