Enhance genre removal logic in Album class
Update removeGenre method to check for null IDs.
This commit is contained in:
parent
7b7d1e7348
commit
9e3516aacb
|
|
@ -98,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 só os gêneros
|
// Método conveniente para pegar só os gêneros
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue