From de2db2a9db4df6b05725781f4fe8edcfe125716c Mon Sep 17 00:00:00 2001 From: Eduard Tihomiorv Date: Fri, 7 Nov 2025 09:46:17 +0300 Subject: [PATCH] SUPPORT-9536: Fix npe --- .../ervu/security/esia/service/MchdService.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/ru/micord/ervu/security/esia/service/MchdService.java b/backend/src/main/java/ru/micord/ervu/security/esia/service/MchdService.java index 612730fc..0e7f2ebd 100644 --- a/backend/src/main/java/ru/micord/ervu/security/esia/service/MchdService.java +++ b/backend/src/main/java/ru/micord/ervu/security/esia/service/MchdService.java @@ -7,6 +7,7 @@ import java.net.http.HttpResponse; import java.time.Duration; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; @@ -78,10 +79,13 @@ public class MchdService { private boolean isEsiaMchdNotFoundError(HttpResponse response) throws JsonProcessingException { if (response.statusCode() == 400) { - String errorCode = objectMapper.readTree(response.body()) - .get("code") - .asText(); - return errorCode.equals("ESIA-044009"); + JsonNode jsonNode = objectMapper.readTree(response.body()) + .get("code"); + if (jsonNode == null) { + return false; + } + String errorCode = jsonNode.asText(); + return errorCode != null && errorCode.equals("ESIA-044009"); } return false; }