summaryrefslogtreecommitdiffstats
path: root/gerrit-prettify
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2010-02-24 10:45:30 -0800
committerShawn O. Pearce <sop@google.com>2010-02-24 10:45:35 -0800
commitad34e3b266ce883bf53743c6ccbae37a8c3e773e (patch)
treea68604965ea97eaf8d4d9226bd75c8c6fe0f0941 /gerrit-prettify
parent099d70ec62304b6e0581dbf287a41db53a3a0b98 (diff)
Fix SparseFileContent for delete-only patches
If an edit list is only deletion regions, the B side will wind up with an empty range as there is no new content to include in the file. This is a corner case that means we have to always return false from contains(int) when there is no content. Change-Id: I745fa9ce2071acc2aa83bd84909477afeef0c3d4 Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'gerrit-prettify')
-rw-r--r--gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/SparseFileContent.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/SparseFileContent.java b/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/SparseFileContent.java
index a88ebf7b7b..a5373b8fb9 100644
--- a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/SparseFileContent.java
+++ b/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/SparseFileContent.java
@@ -170,6 +170,10 @@ public class SparseFileContent {
// Binary search for the range, since we know its a sorted list.
//
+ if (ranges.isEmpty()) {
+ return null;
+ }
+
int low = 0;
do {
final int mid = (low + high) / 2;