Skip to content

Commit

Permalink
Move null body node check to BodyResourceData.Load()
Browse files Browse the repository at this point in the history
Fixes NRE with ResetBodyData()
  • Loading branch information
Majiir committed Sep 7, 2014
1 parent e9297dd commit 3a8f47e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Plugin/Kethane/BodyResourceData.cs
Expand Up @@ -28,6 +28,7 @@ public void ScanCell(Cell cell)

public static BodyResourceData Load(IResourceGenerator generator, CelestialBody body, ConfigNode bodyNode)
{
if (bodyNode == null) { bodyNode = new ConfigNode(); }
var resources = generator.Load(body, bodyNode.GetNode("GeneratorData"));
var scans = new CellSet(KethaneData.GridLevel);

Expand Down
2 changes: 1 addition & 1 deletion Plugin/Kethane/ResourceData.cs
Expand Up @@ -45,7 +45,7 @@ public static ResourceData Load(ResourceDefinition resource, ConfigNode resource

foreach (var body in FlightGlobals.Bodies)
{
var bodyNode = bodyNodes.SingleOrDefault(n => n.GetValue("Name") == body.name) ?? new ConfigNode();
var bodyNode = bodyNodes.SingleOrDefault(n => n.GetValue("Name") == body.name);
bodyResources[body] = BodyResourceData.Load(generator, body, bodyNode);
}

Expand Down

0 comments on commit 3a8f47e

Please sign in to comment.