mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
throw error better when planet null
This commit is contained in:
parent
77ae6b8450
commit
7a400e2046
@ -245,20 +245,10 @@ namespace NewHorizons.Handlers
|
||||
try
|
||||
{
|
||||
NHLogger.Log($"Creating [{body.Config.name}]");
|
||||
var planetObject = GenerateBody(body, defaultPrimaryToSun);
|
||||
try
|
||||
{
|
||||
planetObject?.SetActive(true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
NHLogger.LogError($"Error when activating new planet [{body.Config.name}] - {e}");
|
||||
}
|
||||
if (planetObject == null)
|
||||
{
|
||||
body.UnloadCache();
|
||||
return false;
|
||||
}
|
||||
var planetObject = GenerateBody(body, defaultPrimaryToSun)
|
||||
?? throw new NullReferenceException("Something went wrong when generating the body but no errors were logged.");
|
||||
|
||||
planetObject.SetActive(true);
|
||||
|
||||
var ao = planetObject.GetComponent<NHAstroObject>();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user