[Libreoffice-commits] .: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 2 13:03:59 PST 2013


 sc/source/ui/unoobj/dapiuno.cxx |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit c27e334661b62897a81a450ea9188f80e053261e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Jan 2 16:03:35 2013 -0500

    fdo#58539: Avoid throwing exception not specified in the signature.
    
    This should fix the crasher with the fdo#45266 document.
    
    Change-Id: I41cf02f211e289b85c31b2d2d60e0c4d849b7e8e

diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index feb8b4c..07c2693 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -2697,8 +2697,16 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( cons
         Reference< XNameAccess > xFields(mrParent.getDataPilotFields(), UNO_QUERY);
         if (xFields.is())
         {
-            xRet.set(xFields->getByName(sNewDim), UNO_QUERY);
-            OSL_ENSURE(xRet.is(), "there is a name, so there should be also a field");
+            try
+            {
+                xRet.set(xFields->getByName(sNewDim), UNO_QUERY);
+                OSL_ENSURE(xRet.is(), "there is a name, so there should be also a field");
+            }
+            catch (const container::NoSuchElementException&)
+            {
+                // Avoid throwing exception that's not specified in the method signature.
+                throw RuntimeException();
+            }
         }
     }
     return xRet;


More information about the Libreoffice-commits mailing list