Skip to content

Commit

Permalink
Prevent infinite recursion when visualizer mappings of the same node …
Browse files Browse the repository at this point in the history
…are combined together

Fixes #1769
  • Loading branch information
PathogenDavid committed May 15, 2024
1 parent c5db2c0 commit 66a67ad
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Bonsai.Editor/Layout/LayoutHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,13 @@ static IReadOnlyList<VisualizerFactory> GetMashupArguments(InspectBuilder builde
if (visualizerMappings.Count == 0) return Array.Empty<VisualizerFactory>();
return visualizerMappings.Select(mapping =>
{
var nestedSources = GetMashupArguments(mapping.Source, typeVisualizerMap);
// mapping.Source == builder if two visualizers in the mashup visualize the same node
var nestedSources = mapping.Source == builder
? throw new WorkflowBuildException("Visualizer mappings of same node are combined together.", builder)
: GetMashupArguments(mapping.Source, typeVisualizerMap);

var visualizerType = mapping.VisualizerType ?? typeVisualizerMap.GetTypeVisualizers(mapping.Source).FirstOrDefault();

return new VisualizerFactory(mapping.Source, visualizerType, nestedSources);
}).ToList();
}
Expand Down

0 comments on commit 66a67ad

Please sign in to comment.