Skip to content

Commit

Permalink
Fixed missing recursion key Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Nov 7, 2024
1 parent 29623f7 commit d219aba
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 d219aba

Please sign in to comment.