diff -r aaadcca77f1f writerfilter/source/dmapper/DomainMapper_Impl.cxx --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx Sun Dec 20 20:17:35 2009 +0100 +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx Mon Jan 04 07:46:08 2010 +0100 @@ -2562,6 +2562,12 @@ -----------------------------------------------------------------------*/ void DomainMapper_Impl::AppendFieldCommand(::rtl::OUString& rPartOfCommand) { + OSL_ENSURE(!m_aFieldStack.empty(), "no field to append to"); + if (m_aFieldStack.empty()) + { + return; + } + FieldContextPtr pContext = m_aFieldStack.top(); OSL_ENSURE( pContext.get(), "no field context available"); if( pContext.get() ) @@ -2578,6 +2584,12 @@ -----------------------------------------------------------------------*/ void DomainMapper_Impl::CloseFieldCommand() { + OSL_ENSURE(!m_aFieldStack.empty(), "no field to close"); + if (m_aFieldStack.empty()) + { + return; + } + FieldContextPtr pContext = m_aFieldStack.top(); OSL_ENSURE( pContext.get(), "no field context available"); if( pContext.get() ) @@ -3302,11 +3314,14 @@ { bool bRet = false; OSL_ENSURE( !m_aFieldStack.empty(), "field stack empty?"); - FieldContextPtr pContext = m_aFieldStack.top(); - OSL_ENSURE( pContext.get(), "no field context available"); - if( pContext.get() ) + if (!m_aFieldStack.empty()) { - bRet = pContext->GetTextField().is(); + FieldContextPtr pContext = m_aFieldStack.top(); + OSL_ENSURE( pContext.get(), "no field context available"); + if( pContext.get() ) + { + bRet = pContext->GetTextField().is(); + } } return bRet; } @@ -3315,6 +3330,12 @@ -----------------------------------------------------------------------*/ void DomainMapper_Impl::SetFieldResult( ::rtl::OUString& rResult ) { + OSL_ENSURE(!m_aFieldStack.empty(), "no field to set result to"); + if (m_aFieldStack.empty()) + { + return; + } + FieldContextPtr pContext = m_aFieldStack.top(); OSL_ENSURE( pContext.get(), "no field context available"); if( pContext.get() ) @@ -3365,6 +3386,12 @@ -----------------------------------------------------------------------*/ void DomainMapper_Impl::PopFieldContext() { + OSL_ENSURE(!m_aFieldStack.empty(), "no field to pop"); + if (m_aFieldStack.empty()) + { + return; + } + FieldContextPtr pContext = m_aFieldStack.top(); OSL_ENSURE( pContext.get(), "no field context available"); if( pContext.get() )