From: David ‘Bombe’ Roden Date: Mon, 2 Jun 2014 04:40:42 +0000 (+0200) Subject: Remove all existing posts of a Sone correctly. X-Git-Tag: 0.9-rc1^2~3^2~257 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=7f2bdf1948d876ae8cdefc1470a5bfb6e9506cbb;p=Sone.git Remove all existing posts of a Sone correctly. --- 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);