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.mehrbrodt@allotropia.de>
diff --git a/include/unotools/VersionConfig.hxx b/include/unotools/VersionConfig.hxx
index f94dfe56..a16e9f0 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;
}