From d127c36ae1d62d93c718117506966ced68854d87 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 30 Nov 2017 06:23:22 +0100 Subject: [PATCH] Prevent null-pointer exception if property is missing --- src/main/java/net/pterodactylus/sone/core/Core.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 6292934..7384eda 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -1712,7 +1712,13 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, if (sone.isLocal()) { return; } - sone.setLatestEdition(fromNullable(tryParse(identity.getProperty("Sone.LatestEdition"))).or(sone.getLatestEdition())); + String newLatestEdition = identity.getProperty("Sone.LatestEdition"); + if (newLatestEdition != null) { + Long parsedNewLatestEdition = tryParse(newLatestEdition); + if (parsedNewLatestEdition != null) { + sone.setLatestEdition(parsedNewLatestEdition); + } + } soneDownloader.addSone(sone); soneDownloaders.execute(soneDownloader.fetchSoneAction(sone)); } -- 2.7.4