mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
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:
committed by
Ron Evans
parent
9cad8bd0c8
commit
78a26fec13
+1
-1
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user