Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
Check for world before dereferencing (#1365)
Browse files Browse the repository at this point in the history
* Check for world before dereferencing

* Remove warning
  • Loading branch information
m-samiec authored Sep 24, 2019
1 parent c146289 commit 059e9ad
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,11 @@ void USpatialNetDriver::BeginDestroy()
// Destroy the connection to disconnect from SpatialOS if we aren't meant to persist it.
if (!bPersistSpatialConnection)
{
Cast<USpatialGameInstance>(GetWorld()->GetGameInstance())->DestroySpatialWorkerConnection();
if (UWorld* LocalWorld = GetWorld())
{
Cast<USpatialGameInstance>(LocalWorld->GetGameInstance())->DestroySpatialWorkerConnection();
}

Connection = nullptr;
}
}
Expand Down

0 comments on commit 059e9ad

Please sign in to comment.