Skip to content

Commit 016cbbe

Browse files
authored
Merge pull request #464 from jneb802/dev
Fix: Release() call during SoftReference location registration causes intermittent NullReferenceException
2 parents f6409e7 + d104504 commit 016cbbe

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

JotunnLib/Managers/ZoneManager.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,11 @@ private void RegisterLocationInZoneSystem(ZoneSystem zoneSystem, ZoneLocation zo
638638
zoneSystem.m_locations.Add(zoneLocation);
639639
}
640640

641-
zoneLocation.m_prefab.Release();
641+
// Only release if the asset is currently loaded (meaning PrepareLocation called Load)
642+
if (zoneLocation.m_prefab.IsLoaded)
643+
{
644+
zoneLocation.m_prefab.Release();
645+
}
642646
}
643647

644648
private static void InvokeOnVanillaLocationsAvailable() => OnVanillaLocationsAvailable?.SafeInvoke();

0 commit comments

Comments
 (0)