From d9b5b36c27ff99f430d17756fe6f5a1537447d3b Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sat, 28 Dec 2024 23:24:03 +0100 Subject: [PATCH] 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. --- srcs/juloo.keyboard2/KeyValue.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index 9d3e0ef..57fe88d 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -291,6 +291,8 @@ public final class KeyValue implements Comparable private KeyValue(Object p, int kind, int value, int flags) { + if (p == null) + throw new NullPointerException("KeyValue payload cannot be null"); _payload = p; _code = (kind & KIND_BITS) | (flags & FLAGS_BITS) | (value & VALUE_BITS); }