summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/core/xmltoken.cxx26
-rw-r--r--xmloff/source/text/txtimp.cxx2
2 files changed, 17 insertions, 11 deletions
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index ae4c35924119..801ce5f0a80d 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3176,17 +3176,23 @@ namespace xmloff { namespace token {
const OUString& GetXMLToken( enum XMLTokenEnum eToken )
{
#if OSL_DEBUG_LEVEL > 0
- // check the consistency of the token list. Below, we use the ordinal value of
- // the token as index into the token list, so we should make sure that every
- // entry is at the proper position
- const XMLTokenEntry* pEntry = aTokenList;
- const XMLTokenEntry* pEntryEnd = pEntry + sizeof ( aTokenList ) / sizeof ( XMLTokenEntry );
- sal_uInt16 nPos = 0;
- while ( pEntry < pEntryEnd )
+ static bool s_bChecked = false;
+ if (!s_bChecked)
{
- OSL_ENSURE( nPos == (sal_uInt16)(pEntry->eToken),
- "xmloff::GetXMLToken: inconsistency in the token list!" );
- ++pEntry, ++nPos;
+ // check the consistency of the token list. Below, we use the
+ // ordinal value of the token as index into the token list, so we
+ // should make sure that every entry is at the proper position
+ const XMLTokenEntry* pEntry = aTokenList;
+ const XMLTokenEntry* pEntryEnd =
+ pEntry + SAL_N_ELEMENTS(aTokenList);
+ sal_uInt16 nPos = 0;
+ while (pEntry < pEntryEnd)
+ {
+ assert(nPos == static_cast<sal_uInt16>(pEntry->eToken));
+ // "xmloff::GetXMLToken: inconsistency in the token list!"
+ ++pEntry, ++nPos;
+ }
+ s_bChecked = true; // it's all static, checking once is enough
}
#endif
DBG_ASSERT( eToken > XML_TOKEN_INVALID, "token value too low!" );
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index b48225aac68d..3abafb5fd3f7 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -1803,7 +1803,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
style, if it has no direct list style property and (if exists) the
automatic paragraph style has also no direct list style set.
*/
- if (m_pImpl->m_xParaStyles->hasByName(sStyleName))
+ if (m_pImpl->m_xParaStyles.is() && m_pImpl->m_xParaStyles->hasByName(sStyleName))
{
bool bOutlineStyleCandidate( false );