From: David ‘Bombe’ Roden Date: Sat, 18 Jul 2015 08:35:00 +0000 (+0200) Subject: Store Sone earlier when creating new Sone X-Git-Tag: 0.9.1^2~3 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=b64a9dcfdd584c6c6b7da45066b27bcc17cf6942;p=Sone.git Store Sone earlier when creating new Sone This prevents a NullPointerException spotted by s243. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 73bb95f..95b4bfe 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -645,13 +645,14 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, sone.setLatestEdition(fromNullable(tryParse(property)).or(0L)); sone.setClient(new Client("Sone", SonePlugin.VERSION.toString())); sone.setKnown(true); + loadSone(sone); + sone.setStatus(SoneStatus.idle); + database.storeSone(sone); SoneInserter soneInserter = new SoneInserter(this, eventBus, freenetInterface, ownIdentity.getId()); eventBus.register(soneInserter); synchronized (soneInserters) { soneInserters.put(sone, soneInserter); } - loadSone(sone); - sone.setStatus(SoneStatus.idle); soneInserter.start(); return sone; } @@ -1085,7 +1086,6 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, for (Album album : topLevelAlbums) { sone.getRootAlbum().addAlbum(album); } - database.storeSone(sone); synchronized (soneInserters) { soneInserters.get(sone).setLastInsertFingerprint(lastInsertFingerprint); }