diff --git a/src/dorkbox/util/collections/LockFreeIntBiMap.java b/src/dorkbox/util/collections/LockFreeIntBiMap.java index 07475f0..2d922dd 100644 --- a/src/dorkbox/util/collections/LockFreeIntBiMap.java +++ b/src/dorkbox/util/collections/LockFreeIntBiMap.java @@ -300,7 +300,9 @@ class LockFreeIntBiMap { public synchronized V remove(final int key) { V value = forwardHashMap.remove(key); - reverseHashMap.remove(value, defaultReturnValue); + if (value != null) { + reverseHashMap.remove(value, defaultReturnValue); + } return value; } diff --git a/src/dorkbox/util/collections/LockFreeObjectIntBiMap.java b/src/dorkbox/util/collections/LockFreeObjectIntBiMap.java index cf40ef0..55cd158 100644 --- a/src/dorkbox/util/collections/LockFreeObjectIntBiMap.java +++ b/src/dorkbox/util/collections/LockFreeObjectIntBiMap.java @@ -276,7 +276,9 @@ class LockFreeObjectIntBiMap { public synchronized int remove(final V key) { int value = forwardHashMap.remove(key, defaultReturnValue); - reverseHashMap.remove(value); + if (value != defaultReturnValue) { + reverseHashMap.remove(value); + } return value; }