abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/KeyValue.java
diff options
context:
space:
mode:
authorJules Aguillon2024-12-28 23:24:03 +0100
committerJules Aguillon2024-12-28 23:24:03 +0100
commitd9b5b36c27ff99f430d17756fe6f5a1537447d3b (patch)
treefd8cdfbf2f51854b3e5306beda8b15cc28becf31 /srcs/juloo.keyboard2/KeyValue.java
parent5b5d8c692e7d188349dac47492c4a50503ef1904 (diff)
downloadunexpected-keyboard-d9b5b36c27ff99f430d17756fe6f5a1537447d3b.tar.gz
unexpected-keyboard-d9b5b36c27ff99f430d17756fe6f5a1537447d3b.zip
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.
Diffstat (limited to 'srcs/juloo.keyboard2/KeyValue.java')
-rw-r--r--srcs/juloo.keyboard2/KeyValue.java2
1 files changed, 2 insertions, 0 deletions
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<KeyValue>
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);
}