[hg] Fixed NPE if hg exe is not configured.
[idea/community.git] / plugins / hg4idea / src / org / zmlx / hg4idea / command / HgAnnotateCommand.java
index 257367f385f3bc0b5936bbcefa662d54bd0930de..c30a73d67c4b04203d8f767be1063d46169b06b7 100644 (file)
@@ -49,7 +49,11 @@ public class HgAnnotateCommand {
     HgCommandExecutor executor = new HgCommandExecutor(project);
     HgCommandResult result = executor.executeInCurrentThread(hgFile.getRepo(), "annotate", Arrays.asList("-cqnudl", hgFile.getRelativePath()));
 
-    List<HgAnnotationLine> annotations = new ArrayList<HgAnnotationLine>();
+    final List<HgAnnotationLine> annotations = new ArrayList<HgAnnotationLine>();
+    if (result == null) {
+      return annotations;
+    }
+
     for (String line : result.getOutputLines()) {
       Matcher matcher = LINE_PATTERN.matcher(line);
       if (matcher.matches()) {