Skip to content

Commit 6f3509f

Browse files
sebschuStanford NLP
authored and
Stanford NLP
committed
fix exception in SemanticGraph#makeSoftCopy if there is no root.
1 parent cc0b6d7 commit 6f3509f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/edu/stanford/nlp/semgraph/SemanticGraph.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1741,7 +1741,8 @@ public List<SemanticGraphEdge> getShortestDirectedPathEdges(IndexedWord source,
17411741

17421742
public SemanticGraph makeSoftCopy() {
17431743
SemanticGraph newSg = new SemanticGraph();
1744-
newSg.setRoot(this.getFirstRoot());
1744+
if ( ! this.roots.isEmpty())
1745+
newSg.setRoot(this.getFirstRoot());
17451746
for (SemanticGraphEdge edge : this.edgeIterable()) {
17461747
newSg.addEdge(edge.getSource(), edge.getTarget(), edge.getRelation(), edge.getWeight(), edge.isExtra());
17471748
}

0 commit comments

Comments
 (0)