PVS: V547 Expression '!bFoundCert' is always true
Since
commit 4b399dbfc4
Author: Sarper Akdemir <sarper.akdemir@allotropia.de>
Date: Tue Sep 10 11:19:08 2024 +0200
tdf#162405: check if there's a matching singing cert only when saving
Change-Id: I4f70843660f4feca12135ddeaa0452d5c57b20c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177427
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
@@ -1911,7 +1911,6 @@ bool SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons
|
|||||||
->createSecurityContext({}),
|
->createSecurityContext({}),
|
||||||
};
|
};
|
||||||
|
|
||||||
bool bFoundCert = false;
|
|
||||||
for (const auto& xSecurityContext : xSecurityContexts)
|
for (const auto& xSecurityContext : xSecurityContexts)
|
||||||
{
|
{
|
||||||
if (xSecurityContext.is())
|
if (xSecurityContext.is())
|
||||||
@@ -1921,7 +1920,6 @@ bool SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons
|
|||||||
|
|
||||||
if (xCert.is() && SfxViewShell::Current())
|
if (xCert.is() && SfxViewShell::Current())
|
||||||
{
|
{
|
||||||
bFoundCert = true;
|
|
||||||
SfxObjectShell* pDocShell = SfxViewShell::Current()->GetObjectShell();
|
SfxObjectShell* pDocShell = SfxViewShell::Current()->GetObjectShell();
|
||||||
svl::crypto::SigningContext aSigningContext;
|
svl::crypto::SigningContext aSigningContext;
|
||||||
aSigningContext.m_xCertificate = std::move(xCert);
|
aSigningContext.m_xCertificate = std::move(xCert);
|
||||||
@@ -1939,8 +1937,7 @@ bool SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!bFoundCert)
|
|
||||||
{
|
|
||||||
// couldn't find the specified default signing certificate!
|
// couldn't find the specified default signing certificate!
|
||||||
// alert the user the document won't be signed
|
// alert the user the document won't be signed
|
||||||
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(
|
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(
|
||||||
@@ -1948,7 +1945,6 @@ bool SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons
|
|||||||
VclMessageType::Error, VclButtonsType::Ok,
|
VclMessageType::Error, VclButtonsType::Ok,
|
||||||
SfxResId(STR_ERROR_NOMATCHINGDEFUALTCERT)));
|
SfxResId(STR_ERROR_NOMATCHINGDEFUALTCERT)));
|
||||||
xBox->run();
|
xBox->run();
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user