sfx2/source/doc/guisaveas.cxx |   20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

New commits:
commit d29348f2da2e405ac651d009354e8f967a216170
Author:     Xisco Fauli <[email protected]>
AuthorDate: Wed Nov 27 16:01:15 2024 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Wed Nov 27 17:37:06 2024 +0100

    PVS: V547 Expression '!bFoundCert' is always true
    
    Since
    commit 4b399dbfc4c3081174be1703a0c98fec1afd761f
    Author: Sarper Akdemir <[email protected]>
    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 <[email protected]>

diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index a266a4a5bb2b..f0d3000a0e0c 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -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
         };

Reply via email to