Skip to content

Commit e3ff8a9

Browse files
fix: SCIP documents may be empty. (#70)
Don't crash if that's the case. See the index in #68.
1 parent c76feaa commit e3ff8a9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bindings/go/scip/convert.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ func (g *graph) emitDocument(index *Index, doc *Document) {
241241
// reference
242242
g.emitEdge("item", reader.Edge{OutV: resultIDs.ReferenceResult, InVs: []int{rangeID}, Document: documentID})
243243
}
244-
g.emitEdge("contains", reader.Edge{OutV: documentID, InVs: rangeIDs})
244+
if len(rangeIDs) != 0 { // a document may be empty
245+
g.emitEdge("contains", reader.Edge{OutV: documentID, InVs: rangeIDs})
246+
}
245247
}
246248

247249
// emitRelationships emits "referenceResults" and "implementationResult" based on the value of scip.SymbolInformation.Relationships

0 commit comments

Comments
 (0)