RLH-21 - Fix Sonar
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bea 2024-11-11 16:23:06 +01:00
parent 211aa26df1
commit c51486751f

View File

@ -38,7 +38,9 @@ public class UserServiceImpl implements UserService
if (userRepository.findById(id).isEmpty()) { if (userRepository.findById(id).isEmpty()) {
throw new UsernameNotFoundException(id.toString()); throw new UsernameNotFoundException(id.toString());
} }
userRepository.delete(userRepository.findById(id).get()); if (userRepository.findById(id).isPresent()) {
userRepository.delete(userRepository.findById(id).get());
}
return true; return true;
} }
} }