include/unotools/VersionConfig.hxx |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

New commits:
commit 1c2dc4bc28a594c15464fdb0f5adaa30baf47af2
Author:     homeboy445 <akshitsa...@gmail.com>
AuthorDate: Tue Nov 2 14:39:26 2021 +0530
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
CommitDate: Tue Mar 1 13:20:41 2022 +0100

    tdf#145486: Catch the error instead of re-checking readOnly state
    
    Change-Id: I555ccad0fae604133effbcf46bf2cb0ad30ac609
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124585
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>

diff --git a/include/unotools/VersionConfig.hxx 
b/include/unotools/VersionConfig.hxx
index f94dfe564b3d..a16e9f0e0b29 100644
--- a/include/unotools/VersionConfig.hxx
+++ b/include/unotools/VersionConfig.hxx
@@ -30,12 +30,21 @@ static bool isProductVersionUpgraded(bool aUpdateVersion)
         = sLastVersion.getToken(0, '.').toInt32() * 10 + 
sLastVersion.getToken(1, '.').toInt32();
     if (iCurrent > iLast)
     {
-        if (aUpdateVersion && 
!officecfg::Setup::Product::ooSetupLastVersion::isReadOnly())
+        if (aUpdateVersion)
         { //update lastversion
-            std::shared_ptr<comphelper::ConfigurationChanges> batch(
-                comphelper::ConfigurationChanges::create());
-            officecfg::Setup::Product::ooSetupLastVersion::set(sSetupVersion, 
batch);
-            batch->commit();
+            try
+            {
+                std::shared_ptr<comphelper::ConfigurationChanges> batch(
+                    comphelper::ConfigurationChanges::create());
+                
officecfg::Setup::Product::ooSetupLastVersion::set(sSetupVersion, batch);
+                batch->commit();
+            }
+            catch (css::lang::IllegalArgumentException&)
+            { //If the value was readOnly.
+                SAL_WARN("desktop.updater", "Updating property 
ooSetupLastVersion to version "
+                                                << sSetupVersion
+                                                << " failed (read-only 
property?)");
+            }
         }
         return true;
     }

Reply via email to