[Mercurial] Fixed NPE (EA-211618): find hg root manually if project is null.
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Wed, 1 Sep 2010 10:39:21 +0000 (14:39 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Wed, 1 Sep 2010 10:39:21 +0000 (14:39 +0400)
plugins/hg4idea/src/org/zmlx/hg4idea/HgUtil.java

index 669a03062a5d5f27fc245a4bfa0843e5dc95eb75..7cd0fe8c7402777da99458810aeeebe0411be383 100644 (file)
@@ -201,6 +201,9 @@ public abstract class HgUtil {
    */
   @Nullable
   public static VirtualFile getHgRootOrNull(Project project, FilePath filePath) {
+    if (project == null) {
+      return getNearestHgRoot(VcsUtil.getVirtualFile(filePath.getPath()));
+    }
     return getNearestHgRoot(VcsUtil.getVcsRootFor(project, filePath));
   }