diff --git a/src/main/java/org/ntlab/citrusserver/repositories/FavoriteManager.java b/src/main/java/org/ntlab/citrusserver/repositories/FavoriteManager.java index b7a9e18..fd8d085 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/FavoriteManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/FavoriteManager.java @@ -129,10 +129,15 @@ public void removeFavoriteByBookID(String accountId, Integer bookId) { // accountIdはamika1107 if(favoritedMap.containsKey(accountId) && favoritedMap.get(accountId).containsKey(bookId)) { for (String otherAccountId : favoritedMap.get(accountId).get(bookId)){ - favoritesMap.get(otherAccountId).get(accountId).remove(bookId); // tesのbookId を削除 + favoritesMap.get(otherAccountId).get(accountId).remove(bookId); + if(favoritesMap.get(otherAccountId).get(accountId).isEmpty()) { + favoritesMap.get(otherAccountId).remove(accountId); + }// tesのbookId を削除 } favoritedMap.get(accountId).remove(bookId); // tedのbookIdを消したいとき } + + } @Override