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.
Этот коммит содержится в:
родитель
9cad8bd0c8
коммит
78a26fec13
1 изменённых файлов: 1 добавлений и 1 удалений
|
@ -244,7 +244,7 @@ func (info *fileInfo) getCursorPosition(cursor C.GoCXCursor) token.Pos {
|
||||||
var column C.unsigned
|
var column C.unsigned
|
||||||
var offset C.unsigned
|
var offset C.unsigned
|
||||||
C.clang_getExpansionLocation(location, &file, &line, &column, &offset)
|
C.clang_getExpansionLocation(location, &file, &line, &column, &offset)
|
||||||
if line == 0 {
|
if line == 0 || file == nil {
|
||||||
// Invalid token.
|
// Invalid token.
|
||||||
return token.NoPos
|
return token.NoPos
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче