Merge pull request #24 from gmbrax/fix/fix-broken-album-method

Fix broken removeGenre implementation in Album entity
This commit is contained in:
Gustavo Henrique Miranda 2025-12-08 00:39:31 -03:00 committed by GitHub
commit 61c5124d27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 3 deletions

View File

@ -98,9 +98,14 @@ public class Album {
} }
public void removeGenre(Genre genre) { public void removeGenre(Genre genre) {
if (genre == null) {
return;
}
albumGenres.removeIf(ag ->
ag.getGenre() != null && ag.getGenre() != null &&
ag.getGenre().getId() != null && ag.getGenre().getId() != null &&
ag.getGenre().getId().equals(genre.getId()) ag.getGenre().getId().equals(genre.getId())
);
} }
// Método conveniente para pegar os gêneros // Método conveniente para pegar os gêneros