Crash when using Tree Layout
valhentai opened this issue · 1 comments
valhentai commented
The WPF Showcase crash when selecting the Tree layout.
it crash in the first line of SimpleTreeLayoutAlgorithm.Compute(..)
method because VertexSizes is null.
public override void Compute(CancellationToken cancellationToken)
{
//crash here
Sizes = new Dictionary<TVertex, Size>( VertexSizes );
I made it work by adding VertexSizes = new Dictionary<TVertex, Size>(vertexSizes);
in the constructor
public SimpleTreeLayoutAlgorithm( TGraph visitedGraph, IDictionary<TVertex, Point> vertexPositions, IDictionary<TVertex, Size> vertexSizes, SimpleTreeLayoutParameters parameters )
: base( visitedGraph, vertexPositions, parameters )
{
VertexSizes = new Dictionary<TVertex, Size>(vertexSizes);
//Contract.Requires( vertexSizes != null );
//Contract.Requires( visitedGraph.Vertices.All( v => vertexSizes.ContainsKey( v ) ) );
}
panthernet commented
Thanks, fixed!