[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sd/source svx/source sw/source

Michael Stahl mstahl at redhat.com
Thu Jul 23 11:56:23 PDT 2015


 sd/source/core/stlpool.cxx                 |    5 ++++-
 svx/source/unodraw/unopool.cxx             |    5 ++++-
 sw/source/core/unocore/SwXTextDefaults.cxx |    7 +++++--
 3 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit f391964c8d2c234d0cdb68322a2abaa4d26a6442
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Jul 15 18:38:38 2015 +0200

    svx, sd, sw: GetPoolDefaultItem() can actually return nullptr
    
    ...if you call ResetPoolDefaultItem() first. Crash found by Varun Dhall.
    
    Change-Id: I409484c172fb5843270aee2425844076a008b4df
    (cherry picked from commit bcb1f81668d9b6a6d807ae32d60ccfce0b36ceb5)
    Reviewed-on: https://gerrit.libreoffice.org/17320
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index f4eee39..a45bbaa 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -1127,7 +1127,10 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
         case HID_PSEUDOSHEET_SUBTITLE :
         {
             // Subtitle template
-            SvxNumRule* pDefaultRule = static_cast<const SvxNumBulletItem*>( rSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET))->GetNumRule();
+            SvxNumBulletItem const*const pItem(
+                static_cast<const SvxNumBulletItem*>(
+                    rSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET)));
+            SvxNumRule *const pDefaultRule = (pItem) ? pItem->GetNumRule() : nullptr;
             DBG_ASSERT( pDefaultRule, "Where is my default template? [CL]" );
 
             if(pDefaultRule)
diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx
index 6d4320c..1077ed4 100644
--- a/svx/source/unodraw/unopool.cxx
+++ b/svx/source/unodraw/unopool.cxx
@@ -321,7 +321,10 @@ uno::Any SvxUnoDrawPool::_getPropertyDefault( const comphelper::PropertyMapEntry
     SfxItemPool* pPool = getModelPool( true );
     const sal_uInt16 nWhich = pPool->GetWhich( (sal_uInt16)pEntry->mnHandle );
     const SfxPoolItem *pItem = pPool->GetPoolDefaultItem ( nWhich );
-    pItem->QueryValue( aAny, pEntry->mnMemberId );
+    if (pItem)
+    {
+        pItem->QueryValue( aAny, pEntry->mnMemberId );
+    }
 
     return aAny;
 }
diff --git a/sw/source/core/unocore/SwXTextDefaults.cxx b/sw/source/core/unocore/SwXTextDefaults.cxx
index 9955b44..5c6e256 100644
--- a/sw/source/core/unocore/SwXTextDefaults.cxx
+++ b/sw/source/core/unocore/SwXTextDefaults.cxx
@@ -219,8 +219,11 @@ Any SAL_CALL SwXTextDefaults::getPropertyDefault( const OUString& rPropertyName
         throw UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
     Any aRet;
     SfxItemPool& rSet (m_pDoc->GetAttrPool());
-    const SfxPoolItem *pItem = rSet.GetPoolDefaultItem ( pMap->nWID );
-    pItem->QueryValue( aRet, pMap->nMemberId );
+    SfxPoolItem const*const pItem = rSet.GetPoolDefaultItem(pMap->nWID);
+    if (pItem)
+    {
+        pItem->QueryValue( aRet, pMap->nMemberId );
+    }
     return aRet;
 }
 


More information about the Libreoffice-commits mailing list