Compare commits

..

2 Commits

Author SHA1 Message Date
Gustavo Henrique Miranda 9e3516aacb
Enhance genre removal logic in Album class
Update removeGenre method to check for null IDs.
2025-12-08 00:14:51 -03:00
Gustavo Henrique Miranda 7b7d1e7348
Update src/main/java/com/mediamanager/model/Album.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-08 00:11:47 -03:00
1 changed files with 7 additions and 5 deletions

View File

@ -74,7 +74,9 @@ public class Album {
public void removeArtist(Artist artist) { public void removeArtist(Artist artist) {
albumArtists.removeIf(aa -> albumArtists.removeIf(aa ->
aa.getArtist() != null && aa.getArtist().getId().equals(artist.getId()) aa.getArtist() != null &&
aa.getArtist().getId() != null &&
aa.getArtist().getId().equals(artist.getId())
); );
} }
@ -96,9 +98,9 @@ public class Album {
} }
public void removeGenre(Genre genre) { public void removeGenre(Genre genre) {
albumGenres.removeIf(ag -> ag.getGenre() != null &&
ag.getGenre() != null && ag.getGenre().getId().equals(genre.getId()) ag.getGenre().getId() != null &&
); ag.getGenre().getId().equals(genre.getId())
} }
// Método conveniente para pegar os gêneros // Método conveniente para pegar os gêneros
@ -219,4 +221,4 @@ public class Album {
", year=" + year + ", year=" + year +
'}'; '}';
} }
} }