From 7f2bdf1948d876ae8cdefc1470a5bfb6e9506cbb Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 2 Jun 2014 06:40:42 +0200 Subject: [PATCH] Remove all existing posts of a Sone correctly. --- .../java/net/pterodactylus/sone/database/memory/MemoryDatabase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java b/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java index 61eb9be..238c533 100644 --- a/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java +++ b/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java @@ -258,8 +258,8 @@ public class MemoryDatabase extends AbstractService implements Database { lock.writeLock().lock(); try { /* remove all posts by the Sone. */ - getPostsFrom(sone.getId()).clear(); - for (Post post : posts) { + Collection oldPosts = getPostsFrom(sone.getId()); + for (Post post : oldPosts) { allPosts.remove(post.getId()); if (post.getRecipientId().isPresent()) { getPostsTo(post.getRecipientId().get()).remove(post); -- 2.7.4