[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Jun 19 06:06:53 PDT 2015
sw/qa/extras/tiledrendering/tiledrendering.cxx | 3 +++
sw/source/uibase/uno/unotxdoc.cxx | 3 +++
2 files changed, 6 insertions(+)
New commits:
commit 0b532178a4936cb6014eba10aa6d5e1f33682e6e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Jun 19 11:16:21 2015 +0200
SwXTextDocument::getTextSelection: fix crash on unsupported mime type
SdXImpressDocument didn't have this problem, FWIW.
Change-Id: Ic88311596b7b92a8e972f366b9e82cca850244f8
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 989e1c7..1006ef9 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -221,6 +221,9 @@ void SwTiledRenderingTest::testGetTextSelection()
comphelper::LibreOfficeKit::setActive();
SwXTextDocument* pXTextDocument = createDoc("shape-with-text.fodt");
+ // No crash, just empty output for unexpected mime type.
+ CPPUNIT_ASSERT_EQUAL(OString(), pXTextDocument->getTextSelection("foo/bar"));
+
SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
// Move the cursor into the first word.
pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 2, /*bBasicCall=*/false);
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index b2e6adb..9c9f15f 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3295,6 +3295,9 @@ OString SwXTextDocument::getTextSelection(const char* pMimeType)
else
aFlavor.DataType = cppu::UnoType< uno::Sequence<sal_Int8> >::get();
+ if (!xTransferable->isDataFlavorSupported(aFlavor))
+ return OString();
+
uno::Any aAny(xTransferable->getTransferData(aFlavor));
OString aRet;
More information about the Libreoffice-commits
mailing list