From 1c2dc4bc28a594c15464fdb0f5adaa30baf47af2 Mon Sep 17 00:00:00 2001 From: homeboy445 Date: Tue, 2 Nov 2021 14:39:26 +0530 Subject: 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 --- include/unotools/VersionConfig.hxx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) 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 batch( - comphelper::ConfigurationChanges::create()); - officecfg::Setup::Product::ooSetupLastVersion::set(sSetupVersion, batch); - batch->commit(); + try + { + std::shared_ptr 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; } -- cgit