From c3055539dfe69e19c28bae7f3ad167ddc7491118 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 13 Oct 2011 06:14:56 +0200 Subject: [PATCH] Only create Sones if create is actually true. --- .../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 ff13faa..d87a712 100644 --- a/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java +++ b/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java @@ -130,7 +130,7 @@ public class MemoryDatabase implements Database { public Sone getLocalSone(String id, boolean create) throws DatabaseException { Validation.begin().isNotNull("Sone ID", id).check(); synchronized (localSones) { - if (!localSones.containsKey(id)) { + if (!localSones.containsKey(id) && create) { localSones.put(id, new Sone(id)); } return localSones.get(id); @@ -144,7 +144,7 @@ public class MemoryDatabase implements Database { public Sone getRemoteSone(String id, boolean create) throws DatabaseException { Validation.begin().isNotNull("Sone ID", id).check(); synchronized (remoteSones) { - if (!remoteSones.containsKey(id)) { + if (!remoteSones.containsKey(id) && create) { remoteSones.put(id, new Sone(id)); } return remoteSones.get(id); -- 2.7.4