Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

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 bonsai-rx#1769
  • Loading branch information
PathogenDavid committed May 20, 2024
1 parent c5db2c0 commit 04f2db6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Bonsai.Editor/Layout/LayoutHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ static IReadOnlyList<VisualizerFactory> GetMashupArguments(InspectBuilder builde
if (visualizerMappings.Count == 0) return Array.Empty<VisualizerFactory>();
return visualizerMappings.Select(mapping =>
{
// stack overflow happens if a visualizer ends up being mapped to itself
if (mapping.Source == builder)
throw new WorkflowBuildException("Combining together visualizer mappings from the same node is not currently supported.", builder);

var nestedSources = GetMashupArguments(mapping.Source, typeVisualizerMap);
var visualizerType = mapping.VisualizerType ?? typeVisualizerMap.GetTypeVisualizers(mapping.Source).FirstOrDefault();
return new VisualizerFactory(mapping.Source, visualizerType, nestedSources);
Expand Down

0 comments on commit 04f2db6

Please sign in to comment.