Skip to content

Commit

Permalink
fix : file null
Browse files Browse the repository at this point in the history
  • Loading branch information
NameIsUser06 committed Jan 8, 2024
1 parent 870d19c commit fa6c815
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ public ResponseEntity<String> execute(PostFriendRequest request, MultipartFile f
User user = userRepository.findByEmail(jwtUtil.extractEmail(httpServletRequest))
.orElseThrow(() -> UserNotFoundException.EXCEPTION);

File savedFile = file.isEmpty() ? fileRepository.save(File.builder().path(fileSaveUtil.save(file)).build()) : null;
File savedFile = null;
if (file != null && !file.isEmpty()) {
savedFile = fileRepository.save(File.builder().path(fileSaveUtil.save(file)).build());
}

Friend friend = Friend.builder()
.user(user)
Expand Down

0 comments on commit fa6c815

Please sign in to comment.