From 88c146004cdce732ad99b86c2b820cb0c81ae152 Mon Sep 17 00:00:00 2001 From: sadilchamishka Date: Tue, 7 Jan 2025 13:50:37 +0530 Subject: [PATCH] Fix possible NPE --- src/main/java/org/wso2/scim2/util/SCIMDecoder.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/wso2/scim2/util/SCIMDecoder.java b/src/main/java/org/wso2/scim2/util/SCIMDecoder.java index d4ee3b3..b1d1c57 100644 --- a/src/main/java/org/wso2/scim2/util/SCIMDecoder.java +++ b/src/main/java/org/wso2/scim2/util/SCIMDecoder.java @@ -54,7 +54,10 @@ public List decodeListedResource(String scimString, ResourceTypeSche //we expect this to be a non-empty JSONArray according to the format Object resources = decodedJsonObj.opt(SCIMConstants.ListedResourceSchemaConstants.RESOURCES); - scimObjects = new ArrayList(); + scimObjects = new ArrayList<>(); + if (resources == null) { + return scimObjects; + } decoder = new JSONDecoder(); for (int i = 0; i < (((JSONArray) resources).length()); i++) { Object object = ((JSONArray) resources).get(i);