Null check on the payload of KeyValue

The code expect that the payload is never null but there are now a lot
of public constructor functions for KeyValue that don't check for this
property.
This commit is contained in:
Jules Aguillon 2024-12-28 23:24:03 +01:00
parent 5b5d8c692e
commit d9b5b36c27

View File

@ -291,6 +291,8 @@ public final class KeyValue implements Comparable<KeyValue>
private KeyValue(Object p, int kind, int value, int flags) private KeyValue(Object p, int kind, int value, int flags)
{ {
if (p == null)
throw new NullPointerException("KeyValue payload cannot be null");
_payload = p; _payload = p;
_code = (kind & KIND_BITS) | (flags & FLAGS_BITS) | (value & VALUE_BITS); _code = (kind & KIND_BITS) | (flags & FLAGS_BITS) | (value & VALUE_BITS);
} }