From cb9c422e201a4f89168c4abf58473a25c2ae7ee3 Mon Sep 17 00:00:00 2001 From: irengrig Date: Fri, 27 Jul 2012 17:34:51 +0400 Subject: [PATCH] IDEA-81273 IOOBE at com.intellij.openapi.editor.ex.util.SegmentArray.getSegmentEnd --- .../openapi/vcs/changes/PreparedFragmentedContent.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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());