Skip to content

Commit cc3089f

Browse files
authored
Merge pull request #36 from LxLeChat/Multiple-types-of-graphs
fixing bug for issue #17
2 parents 6f8e9b2 + 07b9bf3 commit cc3089f

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed

Code/Library/GraphBuilder/ElseIfBuilder.cs

+16-6
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,27 @@ public void CreateEndNode()
4242

4343
public void CreateFalseEdge()
4444
{
45-
// throw new System.NotImplementedException();
4645
Node nextnode = node.GetNextNode();
47-
if (nextnode.GetType() == typeof(ElseNode) )
46+
47+
// Fix issue #17
48+
// if no nextnode present
49+
if (nextnode == null)
4850
{
49-
DotEdge edge = new DotEdge(node.Id,node.GetNextNode().children[0].Id);
51+
DotEdge edge = new DotEdge(node.Id,node.parent.GetEndId());
5052
edge.Label = "False";
5153
DotDefinition.Add(edge);
5254
} else {
53-
DotEdge edge = new DotEdge(node.Id,node.GetNextNode().Id);
54-
edge.Label = "False";
55-
DotDefinition.Add(edge);
55+
56+
if (nextnode.GetType() == typeof(ElseNode) )
57+
{
58+
DotEdge edge = new DotEdge(node.Id,node.GetNextNode().children[0].Id);
59+
edge.Label = "False";
60+
DotDefinition.Add(edge);
61+
} else {
62+
DotEdge edge = new DotEdge(node.Id,node.GetNextNode().Id);
63+
edge.Label = "False";
64+
DotDefinition.Add(edge);
65+
}
5666
}
5767

5868
}

Code/Library/Nodes - Loops/ForNode.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ public ForStatementAst GetAst() {
111111
}
112112

113113
internal override void SetCondition(){
114-
condition = RawAst.Condition.Extent.Text;
114+
// bug fix issue #17
115+
// condition can be null, unfortunally
116+
if ( RawAst.Condition != null ) {
117+
condition = RawAst.Condition.Extent.Text;
118+
}
115119
iterator = RawAst.Iterator.Extent.Text;
116120
}
117121

0 Bytes
Binary file not shown.
100 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
100 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)