cgo: be able to deal with nil files

I'm not sure where they come from but they lead to a crash, so turn them
into token.NoPos.
This commit is contained in:
Ayke van Laethem
2019-04-28 00:07:28 +02:00
committed by Ron Evans
parent 9cad8bd0c8
commit 78a26fec13
+1 -1
View File
@@ -244,7 +244,7 @@ func (info *fileInfo) getCursorPosition(cursor C.GoCXCursor) token.Pos {
var column C.unsigned
var offset C.unsigned
C.clang_getExpansionLocation(location, &file, &line, &column, &offset)
if line == 0 {
if line == 0 || file == nil {
// Invalid token.
return token.NoPos
}