Kaydet (Commit) bcb1f816 authored tarafından Michael Stahl's avatar Michael Stahl

svx, sd, sw: GetPoolDefaultItem() can actually return nullptr

...if you call ResetPoolDefaultItem() first. Crash found by Varun Dhall.

Change-Id: I409484c172fb5843270aee2425844076a008b4df
üst 9fb8b396
...@@ -1127,7 +1127,10 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet, ...@@ -1127,7 +1127,10 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
case HID_PSEUDOSHEET_SUBTITLE : case HID_PSEUDOSHEET_SUBTITLE :
{ {
// Subtitle template // 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]" ); DBG_ASSERT( pDefaultRule, "Where is my default template? [CL]" );
if(pDefaultRule) if(pDefaultRule)
......
...@@ -321,7 +321,10 @@ uno::Any SvxUnoDrawPool::_getPropertyDefault( const comphelper::PropertyMapEntry ...@@ -321,7 +321,10 @@ uno::Any SvxUnoDrawPool::_getPropertyDefault( const comphelper::PropertyMapEntry
SfxItemPool* pPool = getModelPool( true ); SfxItemPool* pPool = getModelPool( true );
const sal_uInt16 nWhich = pPool->GetWhich( (sal_uInt16)pEntry->mnHandle ); const sal_uInt16 nWhich = pPool->GetWhich( (sal_uInt16)pEntry->mnHandle );
const SfxPoolItem *pItem = pPool->GetPoolDefaultItem ( nWhich ); const SfxPoolItem *pItem = pPool->GetPoolDefaultItem ( nWhich );
pItem->QueryValue( aAny, pEntry->mnMemberId ); if (pItem)
{
pItem->QueryValue( aAny, pEntry->mnMemberId );
}
return aAny; return aAny;
} }
......
...@@ -219,8 +219,11 @@ Any SAL_CALL SwXTextDefaults::getPropertyDefault( const OUString& rPropertyName ...@@ -219,8 +219,11 @@ Any SAL_CALL SwXTextDefaults::getPropertyDefault( const OUString& rPropertyName
throw UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); throw UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
Any aRet; Any aRet;
SfxItemPool& rSet (m_pDoc->GetAttrPool()); SfxItemPool& rSet (m_pDoc->GetAttrPool());
const SfxPoolItem *pItem = rSet.GetPoolDefaultItem ( pMap->nWID ); SfxPoolItem const*const pItem = rSet.GetPoolDefaultItem(pMap->nWID);
pItem->QueryValue( aRet, pMap->nMemberId ); if (pItem)
{
pItem->QueryValue( aRet, pMap->nMemberId );
}
return aRet; return 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