Store LatestEdition property only after saving the Sone to disk.
[Sone.git] / src / main / java / net / pterodactylus / sone / core / Core.java
index 1bea477..1c9d668 100644 (file)
@@ -2028,8 +2028,6 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
 
                logger.log(Level.INFO, "Saving Sone: %s", sone);
                try {
-                       ((OwnIdentity) sone.getIdentity()).setProperty("Sone.LatestEdition", String.valueOf(sone.getLatestEdition()));
-
                        /* save Sone into configuration. */
                        String sonePrefix = "Sone/" + sone.getId();
                        configuration.getLongValue(sonePrefix + "/Time").setValue(sone.getTime());
@@ -2135,6 +2133,9 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                        configuration.getBooleanValue(sonePrefix + "/Options/EnableSoneInsertNotifications").setValue(sone.getOptions().getBooleanOption("EnableSoneInsertNotifications").getReal());
 
                        configuration.save();
+
+                       ((OwnIdentity) sone.getIdentity()).setProperty("Sone.LatestEdition", String.valueOf(sone.getLatestEdition()));
+
                        logger.log(Level.INFO, "Sone %s saved.", sone);
                } catch (ConfigurationException ce1) {
                        logger.log(Level.WARNING, "Could not save Sone: " + sone, ce1);