Fix parsing of non-existing edition
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 17 Jul 2015 05:25:12 +0000 (07:25 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 17 Jul 2015 05:25:12 +0000 (07:25 +0200)
src/main/java/net/pterodactylus/sone/core/Core.java

index 1153c0f..73bb95f 100644 (file)
@@ -641,7 +641,8 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
                }
                logger.info(String.format("Adding Sone from OwnIdentity: %s", ownIdentity));
                Sone sone = database.newSoneBuilder().local().from(ownIdentity).build();
-               sone.setLatestEdition(fromNullable(tryParse(ownIdentity.getProperty("Sone.LatestEdition"))).or(0L));
+               String property = fromNullable(ownIdentity.getProperty("Sone.LatestEdition")).or("0");
+               sone.setLatestEdition(fromNullable(tryParse(property)).or(0L));
                sone.setClient(new Client("Sone", SonePlugin.VERSION.toString()));
                sone.setKnown(true);
                SoneInserter soneInserter = new SoneInserter(this, eventBus, freenetInterface, ownIdentity.getId());