From ed295dd1ae9bf01b493f782df05e9cb55ee1f5cb Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Mon, 30 May 2022 15:29:49 +0200 Subject: first arg of ApplyFrame is never null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit e4008dc0c3b43c9eacdd88511075be2b88 did this for ApplyBlockFrame() but didn't chagne ApplyFrame() which is only called from there. Change-Id: I9f1dce3dc7fda23b42e90432c13dfca0aa7f267e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135072 Tested-by: Jenkins CollaboraOffice Reviewed-by: Luboš Luňák --- sc/source/core/data/attarray.cxx | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'sc/source') diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 1b84ae4616a5..f468ce96587f 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -1169,12 +1169,12 @@ void ScAttrArray::MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLine // ApplyFrame - on an entry into the array -bool ScAttrArray::ApplyFrame( const SvxBoxItem* pBoxItem, +bool ScAttrArray::ApplyFrame( const SvxBoxItem& rBoxItem, const SvxBoxInfoItem* pBoxInfoItem, SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight, bool bTop, SCROW nDistBottom ) { - OSL_ENSURE( pBoxItem && pBoxInfoItem, "Missing line attributes!" ); + OSL_ENSURE( pBoxInfoItem, "Missing line attributes!" ); const ScPatternAttr* pPattern = GetPattern( nStartRow ); const SvxBoxItem* pOldFrame = &pPattern->GetItemSet().Get( ATTR_BORDER ); @@ -1194,34 +1194,34 @@ bool ScAttrArray::ApplyFrame( const SvxBoxItem* pBoxItem, if( bLeft && nDistRight==0) { if ( pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::LEFT) ) - aNewFrame.SetLine( pBoxItem->GetLeft(), SvxBoxItemLine::RIGHT ); + aNewFrame.SetLine( rBoxItem.GetLeft(), SvxBoxItemLine::RIGHT ); if ( pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::RIGHT) ) - aNewFrame.SetLine( pBoxItem->GetRight(), SvxBoxItemLine::LEFT ); + aNewFrame.SetLine( rBoxItem.GetRight(), SvxBoxItemLine::LEFT ); } else { if ( (nDistRight==0) ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::LEFT) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::VERT) ) - aNewFrame.SetLine( (nDistRight==0) ? pBoxItem->GetLeft() : pBoxInfoItem->GetVert(), + aNewFrame.SetLine( (nDistRight==0) ? rBoxItem.GetLeft() : pBoxInfoItem->GetVert(), SvxBoxItemLine::RIGHT ); if ( bLeft ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::RIGHT) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::VERT) ) - aNewFrame.SetLine( bLeft ? pBoxItem->GetRight() : pBoxInfoItem->GetVert(), + aNewFrame.SetLine( bLeft ? rBoxItem.GetRight() : pBoxInfoItem->GetVert(), SvxBoxItemLine::LEFT ); } } else { if ( bLeft ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::LEFT) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::VERT) ) - aNewFrame.SetLine( bLeft ? pBoxItem->GetLeft() : pBoxInfoItem->GetVert(), + aNewFrame.SetLine( bLeft ? rBoxItem.GetLeft() : pBoxInfoItem->GetVert(), SvxBoxItemLine::LEFT ); if ( (nDistRight==0) ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::RIGHT) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::VERT) ) - aNewFrame.SetLine( (nDistRight==0) ? pBoxItem->GetRight() : pBoxInfoItem->GetVert(), + aNewFrame.SetLine( (nDistRight==0) ? rBoxItem.GetRight() : pBoxInfoItem->GetVert(), SvxBoxItemLine::RIGHT ); } if ( bTop ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::TOP) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::HORI) ) - aNewFrame.SetLine( bTop ? pBoxItem->GetTop() : pBoxInfoItem->GetHori(), + aNewFrame.SetLine( bTop ? rBoxItem.GetTop() : pBoxInfoItem->GetHori(), SvxBoxItemLine::TOP ); if ( (nDistBottom==0) ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::BOTTOM) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::HORI) ) - aNewFrame.SetLine( (nDistBottom==0) ? pBoxItem->GetBottom() : pBoxInfoItem->GetHori(), + aNewFrame.SetLine( (nDistBottom==0) ? rBoxItem.GetBottom() : pBoxInfoItem->GetHori(), SvxBoxItemLine::BOTTOM ); if (aNewFrame == *pOldFrame) @@ -1242,10 +1242,10 @@ void ScAttrArray::ApplyBlockFrame(const SvxBoxItem& rLineOuter, const SvxBoxInfo SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight) { if (nStartRow == nEndRow) - ApplyFrame(&rLineOuter, pLineInner, nStartRow, nEndRow, bLeft, nDistRight, true, 0); + ApplyFrame(rLineOuter, pLineInner, nStartRow, nEndRow, bLeft, nDistRight, true, 0); else if ( !mvData.empty() ) { - ApplyFrame(&rLineOuter, pLineInner, nStartRow, nStartRow, bLeft, nDistRight, + ApplyFrame(rLineOuter, pLineInner, nStartRow, nStartRow, bLeft, nDistRight, true, nEndRow-nStartRow); if ( nEndRow > nStartRow+1 ) // inner part available? @@ -1259,7 +1259,7 @@ void ScAttrArray::ApplyBlockFrame(const SvxBoxItem& rLineOuter, const SvxBoxInfo for (SCSIZE i=nStartIndex; i<=nEndIndex;) { nTmpEnd = std::min( static_cast(nEndRow-1), mvData[i].nEndRow ); - bool bChanged = ApplyFrame(&rLineOuter, pLineInner, nTmpStart, nTmpEnd, + bool bChanged = ApplyFrame(rLineOuter, pLineInner, nTmpStart, nTmpEnd, bLeft, nDistRight, false, nEndRow - nTmpEnd); nTmpStart = nTmpEnd+1; if (bChanged) @@ -1272,11 +1272,11 @@ void ScAttrArray::ApplyBlockFrame(const SvxBoxItem& rLineOuter, const SvxBoxInfo } } - ApplyFrame(&rLineOuter, pLineInner, nEndRow, nEndRow, bLeft, nDistRight, false, 0); + ApplyFrame(rLineOuter, pLineInner, nEndRow, nEndRow, bLeft, nDistRight, false, 0); } else { - ApplyFrame(&rLineOuter, pLineInner, nStartRow, nEndRow, bLeft, nDistRight, true, 0); + ApplyFrame(rLineOuter, pLineInner, nStartRow, nEndRow, bLeft, nDistRight, true, 0); } } -- cgit