[Mercurial] Fixed possible NPE.
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Tue, 15 Jun 2010 13:09:55 +0000 (17:09 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Tue, 15 Jun 2010 13:09:55 +0000 (17:09 +0400)
plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgChangeProvider.java

index cc52e25a3967ea199e8c0be0fe3583a0f944ec36..d25e69d3c96b77bc97ab87a55d983ff54b643726 100644 (file)
@@ -170,8 +170,9 @@ public class HgChangeProvider implements ChangeProvider {
         final VirtualFile root = vcsManager.getVcsRootFor(vf);
         if (root != null) {
           final HgRevisionNumber beforeRevisionNumber = new HgWorkingCopyRevisionsCommand(myProject).identify(root);
-          builder.processChange(new Change(new HgContentRevision(myProject, new HgFile(myProject, vf), beforeRevisionNumber),
-                                           CurrentContentRevision.create(filePath), FileStatus.MODIFIED), myVcsKey);
+          final ContentRevision beforeRevision = (beforeRevisionNumber == null ? null : 
+                                                  new HgContentRevision(myProject, new HgFile(myProject, vf), beforeRevisionNumber));
+          builder.processChange(new Change(beforeRevision, CurrentContentRevision.create(filePath), FileStatus.MODIFIED), myVcsKey);
         }
       }
     }