Browse Source

Fix NPE in ObjectIdOwnerMap#get

Change-Id: I3812961a27ac410d610ef50c73a28f21bb05ae79
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-5.1
Matthias Sohn 5 years ago
parent
commit
a4216e5382
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdOwnerMap.java

3
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdOwnerMap.java

@ -135,6 +135,9 @@ public class ObjectIdOwnerMap<V extends ObjectIdOwnerMap.Entry>
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public V get(AnyObjectId toFind) { public V get(AnyObjectId toFind) {
if (toFind == null) {
return null;
}
int h = toFind.w1; int h = toFind.w1;
V obj = directory[h & mask][h >>> SEGMENT_SHIFT]; V obj = directory[h & mask][h >>> SEGMENT_SHIFT];
for (; obj != null; obj = (V) obj.next) for (; obj != null; obj = (V) obj.next)

Loading…
Cancel
Save