diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/PreparedFragmentedContent.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/PreparedFragmentedContent.java index 7582b10d7c7a..09dc3f1b334a 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/PreparedFragmentedContent.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/PreparedFragmentedContent.java @@ -265,7 +265,8 @@ public class PreparedFragmentedContent { if (myRanges == null || myRanges.isEmpty()) return Collections.emptyList(); if (lines == -1) { final List> shiftedRanges = new ArrayList>(1); - shiftedRanges.add(new BeforeAfter(new TextRange(0, oldDocument.getLineCount() - 1), new TextRange(0, document.getLineCount() - 1))); + shiftedRanges.add(new BeforeAfter(new TextRange(0, oldDocument.getLineCount() == 0 ? 0 : oldDocument.getLineCount() - 1), + new TextRange(0, document.getLineCount() == 0 ? 0 : document.getLineCount() - 1))); return shiftedRanges; } final List> shiftedRanges = new ArrayList>(myRanges.size());