aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse
diff options
context:
space:
mode:
authorIvan Frade <ifrade@google.com>2025-04-15 15:34:29 -0700
committerIvan Frade <ifrade@google.com>2025-04-15 15:41:24 -0700
commitf627e89147c437de9d2f527b76bb599323919e73 (patch)
treec57678a6d51fa969efaebd1c2af4055d618f52b3 /org.eclipse.jgit/src/org/eclipse
parent670c17b80eea0ea7beaeb3c2d8f528d1a6a52cbf (diff)
downloadjgit-master.tar.gz
jgit-master.zip
MultiPackIndexWriter: Handle empty packsHEADmaster
If a pack doesn't have data, its offsets are null, not empty. A pack without objects is probably a pathological case, but I bumped into this while writing other tests. Check if the offsets are null (instead of empty) before trying to write the ridx. Change-Id: I8cadea086b302b2ead02a5a8d4e9e8adf85bc07b
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/midx/MultiPackIndexWriter.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/midx/MultiPackIndexWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/midx/MultiPackIndexWriter.java
index 5488188b7c..9d37450a46 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/midx/MultiPackIndexWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/midx/MultiPackIndexWriter.java
@@ -299,7 +299,7 @@ public class MultiPackIndexWriter {
for (int i = 0; i < ctx.data.getPackCount(); i++) {
List<OffsetPosition> offsetsForPack = packOffsets
.get(Integer.valueOf(i));
- if (offsetsForPack.isEmpty()) {
+ if (offsetsForPack == null) {
continue;
}
offsetsForPack.sort(Comparator.comparing(OffsetPosition::offset));