This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit ce8fa6bf798c49146c367c0276ace4097e205838
Author: Francesco Chicchiriccò <ilgro...@apache.org>
AuthorDate: Mon Feb 27 08:47:26 2023 +0100

    Avoiding NPE when requesting to add fields from a null object
---
 .../java/org/apache/syncope/core/provisioning/api/jexl/JexlUtils.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git 
a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/jexl/JexlUtils.java
 
b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/jexl/JexlUtils.java
index 4692f82876..88dcfae594 100644
--- 
a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/jexl/JexlUtils.java
+++ 
b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/jexl/JexlUtils.java
@@ -121,6 +121,10 @@ public final class JexlUtils {
     }
 
     public static void addFieldsToContext(final Object object, final 
JexlContext jexlContext) {
+        if (object == null) {
+            return;
+        }
+
         Set<Pair<PropertyDescriptor, Field>> cached = 
FIELD_CACHE.get(object.getClass());
         if (cached == null) {
             FIELD_CACHE.put(object.getClass(), Collections.synchronizedSet(new 
HashSet<>()));

Reply via email to