Skip to content

Commit

Permalink
Don't try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
xen-42 committed Oct 18, 2023
1 parent 58fca35 commit 9778ecd
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions NewHorizons/Handlers/PlanetDestructionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ public static void RemoveStockPlanets()
{
foreach (var gameObject in toDisable)
{
// Somehow SetActive can NRE
// Seems to only happen if they don't have the DLC installed
// Even with the null check it's complaining so I don't understand at all
try
// The gameObject can be null, seems to only happen if they don't have the DLC installed
// null coalesence doesn't work with game objects so don't use it here
if (gameObject != null)
{
gameObject?.SetActive(false);
gameObject.SetActive(false);
}
catch { }
}
// Kill all non nh proxies
foreach (var proxy in GameObject.FindObjectsOfType<ProxyBody>())
Expand Down

0 comments on commit 9778ecd

Please sign in to comment.