Skip to content

Commit

Permalink
Hotfix: npe fix
Browse files Browse the repository at this point in the history
  • Loading branch information
versatile0010 committed Nov 15, 2023
1 parent 3a732f2 commit 2b50d35
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ public GetTokenResponse loginKakao(GetTokenRequest tokenRequest) {
try {
ResponseEntity<KakaoInfoResponse> response = restTemplate.exchange(kakaoProperties.getUser_api_url(), HttpMethod.GET, new HttpEntity<>(null, headers), KakaoInfoResponse.class);
String email = response.getBody().getKakao_account().getEmail();
String realName = Optional.ofNullable(response.getBody().getKakao_account().getProfile().getNickname())
.orElse("사용자");
String realName = "실명을 가져올 수 없습니다.";
if(response.getBody().getKakao_account().getProfile() != null){
realName = response.getBody().getKakao_account().getProfile().getNickname();
}
return getTokenResponse(email, realName);
} catch (Exception e) {
throw new BadRequestSocialTokenException();
Expand All @@ -63,7 +65,7 @@ public GetTokenResponse loginNaver(GetTokenRequest tokenRequest) {

String email = response.getBody().getResponse().getEmail();
String realName = Optional.ofNullable(response.getBody().getResponse().getName())
.orElse("사용자");
.orElse("실명을 가져올 수 없습니다.");
return getTokenResponse(email, realName);
} catch (Exception e) {
throw new BadRequestSocialTokenException();
Expand Down

0 comments on commit 2b50d35

Please sign in to comment.