Skip to content

Commit

Permalink
Added safety, if planet definition is null, to return no planet
Browse files Browse the repository at this point in the history
  • Loading branch information
8vogt committed Feb 19, 2021
1 parent 8e4b9e1 commit 06ab143
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions SEWorldGenPlugin/Generator/MyStarSystemGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ private MySystemPlanet GeneratePlanet(int planetIndex, double maxDiameter, long
var settings = MySettingsSession.Static.Settings.GeneratorSettings.PlanetSettings;

var def = FindPlanetDefinitionForSize(maxDiameter);

if (def == null) return null;

var diameter = CalculatePlanetDiameter(def);

var angle = MyRandom.Instance.GetRandomFloat(0, (float)(2 * Math.PI));
Expand Down

0 comments on commit 06ab143

Please sign in to comment.