Skip to content

Commit 530b038

Browse files
committed
Fix possible NPE reported by FindBugs.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1495269 13f79535-47bb-0310-9956-ffa450edef68
1 parent 93a07b9 commit 530b038

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/main/java/org/apache/commons/csv/CSVLexer.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,13 @@ Token nextToken(final Token token) throws IOException {
8686
}
8787

8888
if (isStartOfLine(lastChar) && isCommentStart(c)) {
89-
final String comment = in.readLine().trim();
89+
String line = in.readLine();
90+
if (line == null) {
91+
token.type = EOF;
92+
// don't set token.isReady here because no content
93+
return token;
94+
}
95+
final String comment = line.trim();
9096
token.content.append(comment);
9197
token.type = COMMENT;
9298
return token;

0 commit comments

Comments
 (0)