Skip to content

Commit

Permalink
Merge pull request #691 from mcneel/ein/8.x/missingRecursionKey
Browse files Browse the repository at this point in the history
Fixed missing recursion key Exception
  • Loading branch information
andyopayne authored Nov 7, 2024
2 parents c59b412 + d219aba commit 6e1eef8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/hops/HopsComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Rhino;
using System.Drawing;
using Grasshopper;
using Grasshopper.Kernel.Expressions;

namespace Hops
{
Expand Down Expand Up @@ -88,12 +89,15 @@ protected override void BeforeSolveInstance()
_enabledThisSolve = true;
_lastCreatedSchema = null;
_solveRecursionLevel = 0;
var doc = OnPingDocument();

if (_isHeadless && doc != null)
if (_isHeadless &&
OnPingDocument() is GH_Document doc)
{
// compute will set the ComputeRecursionLevel
_solveRecursionLevel = doc.ConstantServer["ComputeRecursionLevel"]._Int;
if (doc.ConstantServer.TryGetValue("ComputeRecursionLevel", out GH_Variant recursionLevel))
// compute will set the ComputeRecursionLevel
_solveRecursionLevel = recursionLevel._Int;
else
_solveRecursionLevel = HopsAppSettings.RecursionLimit;
}

if (!_solvedCallback)
Expand Down

0 comments on commit 6e1eef8

Please sign in to comment.