Kaydet (Commit) 91aa1d81 authored tarafından Miklos Vajna's avatar Miklos Vajna

SwXTextDocument::getTextSelection: fix crash on unsupported mime type

SdXImpressDocument didn't have this problem, FWIW.

Change-Id: Ic88311596b7b92a8e972f366b9e82cca850244f8
(cherry picked from commit 0b532178)
üst d28da3c4
......@@ -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);
......
......@@ -3297,6 +3297,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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment