diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-07-03 21:38:48 +1000 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-07-04 15:40:01 +0200 |
commit | 67c20d4a02c55bd1749f7cdacd8a56df9c370d98 (patch) | |
tree | 2f7bcd14545732e21e2c1c721955d6d2f8f312fe /sw | |
parent | c90312c6d61bfa43c70c9acf1093edd731c5f02a (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>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 8b045595d2c3..90499f74dd59 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1153,6 +1153,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, const bool bIsMergeSilent = IsMergeSilent(); bool bCheckSingleFile_ = rMergeDescriptor.bCreateSingleFile; + OUString sPrefix_ = rMergeDescriptor.sPrefix; if( bMT_EMAIL ) { assert( !rMergeDescriptor.bPrefixIsFilename ); @@ -1161,11 +1162,13 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, } else if( bMT_SHELL || bMT_PRINTER ) { - assert( !rMergeDescriptor.bPrefixIsFilename ); 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; @@ -1388,7 +1391,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_ @@ -1634,11 +1637,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(); } |