From 86a567f6152315f5d55309c7119885d0fa3476ce Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Sat, 17 Aug 2019 00:20:01 +0200 Subject: [PATCH] Fix NPE in RebaseTodoFile#parseComments Change-Id: I5487f3c2609eaf2a0ddf71ebb2f6c9701fb7600c Signed-off-by: Matthias Sohn --- .../src/org/eclipse/jgit/lib/RebaseTodoFile.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java index 06b4b227c8..0d31851836 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java @@ -137,11 +137,13 @@ public class RebaseTodoFile { if (skip != -1) { // try to parse the line as non-comment line = parseLine(buf, skip, lineEnd); - // successfully parsed as non-comment line - // mark this line as a comment explicitly - line.setAction(Action.COMMENT); - // use the read line as comment string - line.setComment(commentString); + if (line != null) { + // successfully parsed as non-comment line + // mark this line as a comment explicitly + line.setAction(Action.COMMENT); + // use the read line as comment string + line.setComment(commentString); + } } } catch (Exception e) { // parsing as non-comment line failed -- 2.39.5