[Libreoffice-commits] core.git: sc/source

Pranav Kant pranavk at collabora.com
Wed Jun 8 05:04:13 UTC 2016


 sc/source/ui/unoobj/docuno.cxx |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 82ed95b7554cfa3b5e98f67cc53c6219e3a09886
Author: Pranav Kant <pranavk at collabora.com>
Date:   Wed Jun 8 10:27:58 2016 +0530

    sc lok: catch unhandled exception
    
    Now, after 432b27ec73940738bb0b4f9d3d749c70a2525700, we do not
    export newlines when empty range is selected. Trying to get
    transfer data in such a case throws an exception.
    
    Change-Id: If2b16bfa2c1932b0599108b989e62e200c1b3b27

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index bc14ff0..1d9d462 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -770,7 +770,21 @@ OString ScModelObj::getTextSelection(const char* pMimeType, OString& rUsedMimeTy
     if (!xTransferable.is() || !xTransferable->isDataFlavorSupported(aFlavor))
         return OString();
 
-    uno::Any aAny(xTransferable->getTransferData(aFlavor));
+    uno::Any aAny;
+    try
+    {
+        aAny = xTransferable->getTransferData(aFlavor);
+    }
+    catch (const datatransfer::UnsupportedFlavorException e)
+    {
+        OSL_TRACE("Caught UnsupportedFlavorException '%s'", OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+        return OString();
+    }
+    catch (const css::uno::Exception& e)
+    {
+        OSL_TRACE("Caught UNO Exception '%s'", OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+        return OString();
+    }
 
     OString aRet;
     if (aFlavor.DataType == cppu::UnoType<OUString>::get())


More information about the Libreoffice-commits mailing list