[hg] Fixed NPE if hg exe is not configured.
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Mon, 25 Apr 2011 11:15:07 +0000 (15:15 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Mon, 25 Apr 2011 12:02:16 +0000 (16:02 +0400)
plugins/hg4idea/src/org/zmlx/hg4idea/command/HgAnnotateCommand.java
plugins/hg4idea/src/org/zmlx/hg4idea/command/HgRevisionsCommand.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()) {
index eaa89a78c6c069491552b060618428bb1cec485c..f6167053c7c6f78355410ca2d0b24272f6a8af6c 100644 (file)
@@ -81,7 +81,11 @@ abstract class HgRevisionsCommand {
       hgCommandExecutor, hgFile.getRepo(), template, limit, originalHgFile
     );
 
-    List<HgFileRevision> revisions = new LinkedList<HgFileRevision>();
+    final List<HgFileRevision> revisions = new LinkedList<HgFileRevision>();
+    if (result == null) {
+      return revisions;
+    }
+
     String output = result.getRawOutput();
     String[] changeSets = output.split(HgChangesetUtil.CHANGESET_SEPARATOR);
     for (String line : changeSets) {