writerfilter/source/dmapper/DomainMapper_Impl.cxx | 6 ++++++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 1 + 2 files changed, 7 insertions(+)
New commits: commit 7965bb9a1d8b29778c6eac279537952e6a9e9502 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Sat Apr 11 14:07:02 2020 +0300 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Wed Apr 15 11:18:49 2020 +0200 Revert "NFC writerfilter: remove pointless asserts" This reverts commit 708f95b87410c640f0e9e22892f4a71194631cd9. Stephan said I have it all backwards. Asserts are primarily "documentation", and there is no point in asserting something if you aren't going to accept it as true, at least not without any other qualifying remarks etc. So a simple "assert(p)" should never be followed by "if(p)". These asserts basically show that "yes, I'm using this pointer without checking on purpose, and not as an oversight." Change-Id: I7350b627a2acf027d1a6d5b33ea272050d23ce6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92059 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 6428155d85ce..1e7f8a99e663 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1989,6 +1989,7 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper { m_bStartedTOC = true; uno::Reference< text::XTextCursor > xTOCTextCursor = xTextAppend->getEnd()->getText( )->createTextCursor( ); + assert(xTOCTextCursor.is()); xTOCTextCursor->gotoEnd(false); if (m_nStartGenericField != 0) { @@ -4292,6 +4293,7 @@ DomainMapper_Impl::StartIndexSectionChecked(const OUString& sServiceName) m_bStartedTOC = true; uno::Reference<text::XTextCursor> xTOCTextCursor = xTextRange->getText()->createTextCursor(); + assert(xTOCTextCursor.is()); xTOCTextCursor->gotoEnd(false); m_aTextAppendStack.push(TextAppendContext(xTextAppend, xTOCTextCursor)); } @@ -6528,6 +6530,7 @@ void DomainMapper_Impl::SetCurrentRedlineIsRead() sal_Int32 DomainMapper_Impl::GetCurrentRedlineToken( ) const { + assert(m_currentRedline.get()); return m_currentRedline->m_nToken; } @@ -6580,11 +6583,13 @@ void DomainMapper_Impl::SetCurrentRedlineId( sal_Int32 sId ) void DomainMapper_Impl::SetCurrentRedlineToken( sal_Int32 nToken ) { + assert(m_currentRedline.get()); m_currentRedline->m_nToken = nToken; } void DomainMapper_Impl::SetCurrentRedlineRevertProperties( const uno::Sequence<beans::PropertyValue>& aProperties ) { + assert(m_currentRedline.get()); m_currentRedline->m_aRevertProperties = aProperties; } @@ -6805,6 +6810,7 @@ sal_Int32 DomainMapper_Impl::getNumberingProperty(const sal_Int32 nListId, sal_I nNumberingLevel = 0; auto const pList(GetListTable()->GetList(nListId)); + assert(pList); const OUString aListName = pList->GetStyleName(); const uno::Reference< style::XStyleFamiliesSupplier > xStylesSupplier(GetTextDocument(), uno::UNO_QUERY_THROW); const uno::Reference< container::XNameAccess > xStyleFamilies = xStylesSupplier->getStyleFamilies(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 5429489304f6..3de574e75c12 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2113,6 +2113,7 @@ RTFReferenceTable::Entries_t RTFDocumentImpl::deduplicateStyleTable() auto const pStyleType( static_cast<RTFReferenceProperties&>(*pStyle).getAttributes().find( NS_ooxml::LN_CT_Style_type)); + assert(pStyleType); int const nStyleType(pStyleType->getInt()); RTFSprms const sprms( static_cast<RTFReferenceProperties&>(*pStyle).getSprms().cloneAndDeduplicate( _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits