summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-10-31 18:24:23 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-10-31 18:27:37 +0100
commitcba921ea0b293acc4b4e64f043f2e56d3e4cb15b (patch)
tree7de7f8cf95793385c2a4438e0ed5cc420262d25e /sfx2/source
parentc936fcb0f3e1048e3b7085b1564f8e1f24a44f16 (diff)
Work around new calls to GetFilter()->GetMimeType() on null filter
...introduced with 75bc673b60d3eb40713868ce3d1b4f62dd6e1208 "Travelled MIME type through UCB for CMIS UCP to use it when creating documents" and causing crashes in sc_unoapi test. Many SfxMedium instances appear to have a null filter, so this workaround at least fixes the crashes. No idea what a good fix should look like, so will ask Cedric to review his commit. Change-Id: I27180265b6c79c7ed5f459b03c9e188ff6a0f56d
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/doc/docfile.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index b36a44155b79..9be89f51114a 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -314,6 +314,9 @@ public:
SfxMedium_Impl( SfxMedium* pAntiImplP );
~SfxMedium_Impl();
+
+ OUString getFilterMimeType()
+ { return m_pFilter == 0 ? OUString() : m_pFilter->GetMimeType(); }
};
//------------------------------------------------------------------
@@ -2006,7 +2009,7 @@ void SfxMedium::Transfer_Impl()
try
{
- rtl::OUString aMimeType = GetFilter()->GetMimeType( );
+ rtl::OUString aMimeType = pImp->getFilterMimeType();
::ucbhelper::InsertOperation eOperation = ::ucbhelper::InsertOperation_COPY;
bool bMajor = false;
rtl::OUString sComment;
@@ -2087,7 +2090,7 @@ void SfxMedium::DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalCont
{
try
{
- rtl::OUString sMimeType = GetFilter()->GetMimeType( );
+ rtl::OUString sMimeType = pImp->getFilterMimeType();
if( aBackupCont.transferContent( aOriginalContent,
::ucbhelper::InsertOperation_COPY,
aBackupName,
@@ -2175,7 +2178,7 @@ void SfxMedium::DoBackup_Impl()
try
{
// do the transfer ( copy source file to backup dir )
- rtl::OUString sMimeType = GetFilter()->GetMimeType( );
+ rtl::OUString sMimeType = pImp->getFilterMimeType();
bSuccess = aContent.transferContent( aSourceContent,
::ucbhelper::InsertOperation_COPY,
aFileName,
@@ -3307,7 +3310,7 @@ void SfxMedium::CreateTempFile( sal_Bool bReplace )
if ( !aFileName.isEmpty() && aTmpURLObj.removeSegment() )
{
::ucbhelper::Content aTargetContent( aTmpURLObj.GetMainURL( INetURLObject::NO_DECODE ), xComEnv, comphelper::getProcessComponentContext() );
- rtl::OUString sMimeType = GetFilter()->GetMimeType( );
+ rtl::OUString sMimeType = pImp->getFilterMimeType();
if ( aTargetContent.transferContent( pImp->aContent, ::ucbhelper::InsertOperation_COPY, aFileName, NameClash::OVERWRITE, sMimeType ) )
{
SetWritableForUserOnly( aTmpURL );