Simplify a bit

Change-Id: Ibe34a1c17d856146d191e784af06b8cb6301b912
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172007
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Mike Kaganski 2024-08-18 12:18:38 +05:00
parent fa8a0f514a
commit af15f1eb66

View file

@ -89,17 +89,16 @@ class ScopedWritableGuard
{
public:
ScopedWritableGuard(const SbxVariableRef& rVar, bool bMakeWritable)
: m_rVar(rVar)
, m_bReset(bMakeWritable && !rVar->CanWrite())
: m_rVar(bMakeWritable && !rVar->CanWrite() ? rVar : SbxVariableRef())
{
if (m_bReset)
if (m_rVar)
{
m_rVar->SetFlag(SbxFlagBits::Write);
}
}
~ScopedWritableGuard()
{
if (m_bReset)
if (m_rVar)
{
m_rVar->ResetFlag(SbxFlagBits::Write);
}
@ -107,7 +106,6 @@ public:
private:
SbxVariableRef m_rVar;
bool m_bReset;
};
}