Skip to content

Commit

Permalink
Check for null refs inside streaming warp volume then destroy it
Browse files Browse the repository at this point in the history
  • Loading branch information
xen-42 committed Mar 11, 2024
1 parent 0036028 commit e8b0bf4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions NewHorizons/Components/Volumes/StreamingWarpVolume.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using NewHorizons.Utility.OWML;
using UnityEngine;

namespace NewHorizons.Components.Volumes
Expand All @@ -23,6 +24,23 @@ public void Start()

public void FixedUpdate()
{
// Bug report on Astral Codec mod page - Huge lag inside streaming warp volume, possible NRE?
if (_probe == null)
{
_probe = Locator.GetProbe();
if (_probe == null)
{
NHLogger.LogError($"How is your scout probe null? Destroying {nameof(StreamingWarpVolume)}");
Component.DestroyImmediate(this);
}
}

if (streamingGroup == null)
{
NHLogger.LogError($"{nameof(StreamingWarpVolume)} has no streaming group. Destroying {nameof(StreamingWarpVolume)}");
Component.DestroyImmediate(this);
}

bool probeActive = _probe.IsLaunched() && !_probe.IsAnchored();

bool shouldBeLoadingRequiredAssets = _playerInVolume || (_probeInVolume && probeActive);
Expand Down

0 comments on commit e8b0bf4

Please sign in to comment.