fix: 🐛 Fix nullPointer in SamlAuthenticationDetailsStringCon

pull/1580/head
Dominik Frantisek Bucik 2022-04-11 09:27:40 +02:00
parent 08ddf5b299
commit 3c034f4c54
No known key found for this signature in database
GPG Key ID: 73F752BEC0709845
1 changed files with 5 additions and 2 deletions

View File

@ -172,7 +172,10 @@ public class SamlAuthenticationDetails {
}
private static void addStringOrNull(JsonObject target, String key, String value) {
if (value == null) {
if (target == null || !StringUtils.hasText(key)) {
return;
}
if (value == null || "null".equalsIgnoreCase(value)) {
target.add(key, new JsonNull());
} else {
target.addProperty(key, value);
@ -180,7 +183,7 @@ public class SamlAuthenticationDetails {
}
private static String getStringOrNull(JsonElement jsonElement) {
if (jsonElement.isJsonPrimitive()) {
if (jsonElement != null && jsonElement.isJsonPrimitive()) {
return jsonElement.getAsString();
} else {
return null;