diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-07-03 21:38:48 +1000 |
---|---|---|
committer | Aron Budea <aron.budea@collabora.com> | 2018-07-09 16:27:17 +0200 |
commit | bb08376710a1288210b6ea40c371ce05203e7290 (patch) | |
tree | 943ae7f01b7f870234a78b82d7af6b89a48c12ca /sw | |
parent | c9ac66ddcf8bfa135bbd17b0fbb4e6afdcfc3335 (diff) |
Avoid failing assert in SwDBManager::MergeMailFiles
The failing assert reproducing scenario is the steps in
https://bugs.documentfoundation.org/show_bug.cgi?id=116543#c0
rMergeDescriptor.nMergeType == DBMGR_MERGE_PRINTER;
rMergeDescriptor.bPrefixIsFilename is true;
rMergeDescriptor.sPrefix is empty.
The failing assert is unrelated to the crash in tdf#116543.
It looks like the assertion was incorrect; assert on empty
prefix instead.
Change-Id: Ibeedb90a9fac810124283fc06aa756777fa04720
Reviewed-on: https://gerrit.libreoffice.org/56863
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/57105
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Aron Budea <aron.budea@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 861504c28031..51f0dde9ae05 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1121,19 +1121,22 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, const bool bIsMergeSilent = IsMergeSilent(); bool bCheckSingleFile_ = rMergeDescriptor.bCreateSingleFile; + OUString sPrefix_ = rMergeDescriptor.sPrefix; if( bMT_EMAIL ) { assert( !rMergeDescriptor.bPrefixIsFilename ); - assert( bMT_EMAIL && !bCheckSingleFile_ ); + assert(!bCheckSingleFile_); bCheckSingleFile_ = false; } else if( bMT_SHELL || bMT_PRINTER ) { - assert( !rMergeDescriptor.bPrefixIsFilename ); - assert( (bMT_SHELL || bMT_PRINTER) && bCheckSingleFile_ ); + assert(bCheckSingleFile_); bCheckSingleFile_ = true; + assert(sPrefix_.isEmpty()); + sPrefix_.clear(); } const bool bCreateSingleFile = bCheckSingleFile_; + const OUString sDescriptorPrefix = sPrefix_; // Setup for dumping debugging documents static const char *sMaxDumpDocs = nullptr; @@ -1351,7 +1354,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, // create a new temporary file name - only done once in case of bCreateSingleFile if( bNeedsTempFiles && ( !bWorkDocInitialized || !bCreateSingleFile )) { - OUString sPrefix = rMergeDescriptor.sPrefix; + OUString sPrefix = sDescriptorPrefix; OUString sLeading; //#i97667# if the name is from a database field then it will be used _as is_ @@ -1595,11 +1598,11 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, // save merged document assert( aTempFile.get() ); INetURLObject aTempFileURL; - if( rMergeDescriptor.sPrefix.isEmpty() || !rMergeDescriptor.bPrefixIsFilename ) + if (sDescriptorPrefix.isEmpty() || !rMergeDescriptor.bPrefixIsFilename) aTempFileURL.SetURL( aTempFile->GetURL() ); else { - aTempFileURL.SetURL( rMergeDescriptor.sPrefix ); + aTempFileURL.SetURL(sDescriptorPrefix); // remove the unneeded temporary file aTempFile->EnableKillingFile(); } |