summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-04-26 14:30:03 +0200
committerAndras Timar <andras.timar@collabora.com>2017-05-04 12:48:21 +0200
commit78b654dffea1494467ce26acd6ed64e177c78ac6 (patch)
treefdd1c97a160d5845daea166b60c8ec543bdbdeed /editeng
parent1bd7ee1b5200b146ed50d6689214990b1b257f2a (diff)
check for nullptr, tdf#104265
Crash not reproduced, but a nullptr is believed to be the cause as ParaPortionList::SafeGetObject() may return nullptr if a stray EditPaM was passed to ImpEditEngine::GetI18NScriptType() At least this matches http://cgit.freedesktop.org/libreoffice/core/tree/editeng/source/editeng/impedit2.cxx?h=libreoffice-5-2-4#n1756 given in http://crashreport.libreoffice.org/stats/crash_details/725e8295-6dc0-4b0c-aff3-57c6c95930f2 and http://crashreport.libreoffice.org/stats/crash_details/e2570ac8-6137-4b67-91b2-6cc871f8cb69 Change-Id: Id01983a31145442016da527a57024dc060060b1a (cherry picked from commit 17236fe21f9b0c734c0e8d5c371b8112dcab8ac0) Reviewed-on: https://gerrit.libreoffice.org/36989 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit 9982510049417ce4e3969a492cfdecd3e5ed0760)
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/impedit2.cxx23
1 files changed, 13 insertions, 10 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index c2126570be2b..f4ab41550db3 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1743,18 +1743,21 @@ sal_uInt16 ImpEditEngine::GetI18NScriptType( const EditPaM& rPaM, sal_Int32* pEn
{
sal_Int32 nPara = GetEditDoc().GetPos( rPaM.GetNode() );
const ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara );
- if ( pParaPortion->aScriptInfos.empty() )
- const_cast<ImpEditEngine*>(this)->InitScriptTypes( nPara );
+ if (pParaPortion)
+ {
+ if ( pParaPortion->aScriptInfos.empty() )
+ const_cast<ImpEditEngine*>(this)->InitScriptTypes( nPara );
- const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
+ const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
- const sal_Int32 nPos = rPaM.GetIndex();
- ScriptTypePosInfos::const_iterator itr = std::find_if(rTypes.begin(), rTypes.end(), FindByPos(nPos));
- if(itr != rTypes.end())
- {
- nScriptType = itr->nScriptType;
- if( pEndPos )
- *pEndPos = itr->nEndPos;
+ const sal_Int32 nPos = rPaM.GetIndex();
+ ScriptTypePosInfos::const_iterator itr = std::find_if(rTypes.begin(), rTypes.end(), FindByPos(nPos));
+ if(itr != rTypes.end())
+ {
+ nScriptType = itr->nScriptType;
+ if( pEndPos )
+ *pEndPos = itr->nEndPos;
+ }
}
}
return nScriptType ? nScriptType : SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetDefaultLanguage() );