diff --git a/src/main/java/org/ntlab/citrusserver/repositories/FavoriteManager.java b/src/main/java/org/ntlab/citrusserver/repositories/FavoriteManager.java index 9452ca7..48603ad 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/FavoriteManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/FavoriteManager.java @@ -130,10 +130,12 @@ // bookIdを削除したいとき public void removeFavoriteByBookID(String accountId, Integer bookId) { // accountIdはamika1107 - for (String otherAccountId : favoritedMap.get(accountId).get(bookId)){ - favoritesMap.get(otherAccountId).get(accountId).remove(bookId); // tesのbookId を削除 + 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 を削除 + } + favoritedMap.get(accountId).remove(bookId); // tedのbookIdを消したいとき } - favoritedMap.get(accountId).remove(bookId); // tedのbookIdを消したいとき } @Override