sfx2/source/doc/sfxbasemodel.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e004c9dd2cc0da7f27503d14bfc13975889eea77
Author:     Matt K <matt...@gmail.com>
AuthorDate: Tue Jan 9 17:23:34 2024 -0600
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Thu Jan 11 05:19:28 2024 +0100

    tdf#158937 Allow cancel of password dialog during recovery
    
    The problem is that when a user cancels the password dialog
    during recovery, the code tries to do something with the
    doc, but there is no doc yet because the file is password
    protected and not opened, so it crashes.  The fix is just
    to check for the absence of errors before using the doc
    (canceling the password dialog is considered an abort/
    general IO error).
    
    Change-Id: Ia76d8e4ff8212427d6b7b0a67ce1971b9ea8a48d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161844
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index a996259f3598..3da83626a5ea 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -2026,7 +2026,7 @@ void SAL_CALL SfxBaseModel::load(   const Sequence< 
beans::PropertyValue >& seqA
     if( m_pData->m_pObjectShell->IsAbortingImport() )
         nError = ERRCODE_ABORT;
 
-    if( bSalvage )
+    if (bSalvage && nError == ERRCODE_NONE)
     {
         // file recovery: restore original filter
         const SfxStringItem* pFilterItem = 
pMedium->GetItemSet().GetItem(SID_FILTER_NAME, false);

Reply via email to