Skip to content

Commit 700e9a9

Browse files
committed
Handle nil file when creating a new issue
This can occur when there is a compilation issue into the code. Change-Id: I8b028d454d417c33edc687dcffc68c92d18091d6 Signed-off-by: Cosmin Cojocar <ccojocar@google.com>
1 parent d514c42 commit 700e9a9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

analyzers/util.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ func newIssue(analyzerID string, desc string, fileSet *token.FileSet,
6262
pos token.Pos, severity, confidence issue.Score,
6363
) *issue.Issue {
6464
file := fileSet.File(pos)
65+
if file == nil {
66+
return &issue.Issue{}
67+
}
6568
line := file.Line(pos)
6669
col := file.Position(pos).Column
6770

0 commit comments

Comments
 (0)