Skip to content

Commit

Permalink
🐛[fix]: validation for NPE of user preference
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyesooo committed Oct 26, 2023
1 parent aa967db commit 5cd3008
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public Long updateUserPref(UserPrefDto userPrefDto) {
@Override
public UserPrefDto getUserPrefByUserId(Long userId) {
UserPrefDto userPrefDto = commonConverter.convertToGeneric(userPreferenceRepository.findByUser_Id(userId), UserPrefDto.class);

if(userPrefDto == null) throw new BusinessInvalidValueException("해당 사용자의 명언 취향이 없습니다.");

// "nutty,spicy" -> ['nutty', 'spicy']
userPrefDto.setFlavors(convertStringToList(",", userPrefDto.getFlavor()));
userPrefDto.setSources(convertStringToList(",", userPrefDto.getSource()));
Expand Down

0 comments on commit 5cd3008

Please sign in to comment.