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:
Xisco Fauli 2024-11-27 16:01:15 +01:00
parent aea7c6a013
commit d29348f2da

View file

@ -1911,7 +1911,6 @@ bool SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons
->createSecurityContext({}),
};
bool bFoundCert = false;
for (const auto& xSecurityContext : xSecurityContexts)
{
if (xSecurityContext.is())
@ -1921,7 +1920,6 @@ bool SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons
if (xCert.is() && SfxViewShell::Current())
{
bFoundCert = true;
SfxObjectShell* pDocShell = SfxViewShell::Current()->GetObjectShell();
svl::crypto::SigningContext aSigningContext;
aSigningContext.m_xCertificate = std::move(xCert);
@ -1939,16 +1937,14 @@ bool SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons
}
}
}
if (!bFoundCert)
{
// couldn't find the specified default signing certificate!
// alert the user the document won't be signed
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(
SfxStoringHelper::GetModelWindow(aModelData.GetModel()),
VclMessageType::Error, VclButtonsType::Ok,
SfxResId(STR_ERROR_NOMATCHINGDEFUALTCERT)));
xBox->run();
}
// couldn't find the specified default signing certificate!
// alert the user the document won't be signed
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(
SfxStoringHelper::GetModelWindow(aModelData.GetModel()),
VclMessageType::Error, VclButtonsType::Ok,
SfxResId(STR_ERROR_NOMATCHINGDEFUALTCERT)));
xBox->run();
return;
#endif
};