diff options
| author | Jules Aguillon | 2024-12-28 23:24:03 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2024-12-28 23:24:03 +0100 |
| commit | d9b5b36c27ff99f430d17756fe6f5a1537447d3b (patch) | |
| tree | fd8cdfbf2f51854b3e5306beda8b15cc28becf31 | |
| parent | 5b5d8c692e7d188349dac47492c4a50503ef1904 (diff) | |
| download | unexpected-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.
| -rw-r--r-- | srcs/juloo.keyboard2/KeyValue.java | 2 |
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); } |
