summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.storage.dht/src/org/eclipse
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2011-06-09 16:56:53 -0700
committerShawn O. Pearce <spearce@spearce.org>2011-06-09 17:29:46 -0700
commitd00f527d659c9eb1fabc434b45f94b98e221c509 (patch)
treeacc7e5431bbfd096bded6126d9c42674bd6fa3dc /org.eclipse.jgit.storage.dht/src/org/eclipse
parent0e1d5ad8f8642bc99114b0080204fd4bd28df38d (diff)
downloadjgit-d00f527d659c9eb1fabc434b45f94b98e221c509.tar.gz
jgit-d00f527d659c9eb1fabc434b45f94b98e221c509.zip
DHT: Fix NPE during prefetch
The Prefetcher may have loaded a chunk that is a fragment, if the DhtReader is scanning the Prefetcher's chunks for a particular object fragment chunks will be missing the index and NPE during the findOffset() call into the index itself. Change-Id: Ie2823724c289f745655076c5209acec32361a1ea Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.storage.dht/src/org/eclipse')
-rw-r--r--org.eclipse.jgit.storage.dht/src/org/eclipse/jgit/storage/dht/PackChunk.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/org.eclipse.jgit.storage.dht/src/org/eclipse/jgit/storage/dht/PackChunk.java b/org.eclipse.jgit.storage.dht/src/org/eclipse/jgit/storage/dht/PackChunk.java
index c0684022f3..66d3d3386b 100644
--- a/org.eclipse.jgit.storage.dht/src/org/eclipse/jgit/storage/dht/PackChunk.java
+++ b/org.eclipse.jgit.storage.dht/src/org/eclipse/jgit/storage/dht/PackChunk.java
@@ -291,7 +291,7 @@ public final class PackChunk {
}
int findOffset(RepositoryKey repo, AnyObjectId objId) {
- if (key.getRepositoryId() == repo.asInt())
+ if (key.getRepositoryId() == repo.asInt() && index != null)
return index.findOffset(objId);
return -1;
}