Generate warning when clamping invalid from-to positions

Follow-up patch of https://gerrit.libreoffice.org/c/core/+/201059

Change-Id: I79520a96f991a12999a9bdd993b8786784ebfc34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201426
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201563
(cherry picked from commit a17762062cc07143bfc957d542a175173a4bbcbe)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204514
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Ujjawal Kumar
2026-04-29 21:59:17 +02:00
committed by Xisco Fauli
parent 04bb1367e3
commit fcd434ea9e
+10
View File
@@ -170,6 +170,11 @@ void lcl_GetFromTo( const XclExpRoot& rRoot, const tools::Rectangle &aRect, sal_
}
if( r.Left() > aRect.Left() && r.Top() > aRect.Top() )
{
if (nRow <= 0 || nCol <= 0)
{
SAL_WARN("sc.filter", "Clamping invalid row/column index to 0 while calculating from-to positions row=" << (nRow - 1) << " col=" << (nCol-1));
}
sal_Int32 nNewCol = (nCol > 0) ? nCol - 1 : 0;
sal_Int32 nNewRow = (nRow > 0) ? nRow - 1 : 0;
aFrom = tools::Rectangle( nNewCol, lcl_hmm2output( nColOff, bInEMU ),
@@ -195,6 +200,11 @@ void lcl_GetFromTo( const XclExpRoot& rRoot, const tools::Rectangle &aRect, sal_
}
if( r.Left() < aRect.Left() && r.Top() > aRect.Top() )
{
if (nRow <= 0 || nCol <= 0)
{
SAL_WARN("sc.filter", "Clamping invalid row/column index to 0 while calculating from-to positions row=" << (nRow - 1) << " col=" << (nCol-1));
}
sal_Int32 nNewCol = (nCol > 0) ? nCol - 1 : 0;
sal_Int32 nNewRow = (nRow > 0) ? nRow - 1 : 0;
aFrom = tools::Rectangle( nNewCol, lcl_hmm2output( nColOff, bInEMU ),