sc/source/ui/view/output.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit c0392315ba3691f55ddbcf205544c21f019a9b6a
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Mon Dec 30 06:19:24 2024 -0400
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Jan 7 17:19:14 2025 +0100

    tdf#164130: ensure valid column and row values
    
    Sometimes the range mark has not valid col/row values.
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: I29cf70c8c2a4e832f1ee65abac0ff55e49295fc1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179563
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index ddf3dd5e0b78..417aa596b724 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -2091,7 +2091,8 @@ void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW 
nRefStartY,
 
     if ( nRefStartX == nRefEndX && nRefStartY == nRefEndY )
         mpDoc->ExtendMerge( nRefStartX, nRefStartY, nRefEndX, nRefEndY, nTab );
-    else if (mpDoc->HasAttrib(nRefEndX, nRefEndY, nTab, HasAttrFlags::Merged))
+    else if (mpDoc->ValidCol(nRefEndX) && mpDoc->ValidRow(nRefEndY) &&
+             mpDoc->HasAttrib(nRefEndX, nRefEndY, nTab, HasAttrFlags::Merged))
         mpDoc->ExtendMerge(nRefEndX, nRefEndY, nRefEndX, nRefEndY, nTab);
 
     if ( !(nRefStartX <= nVisX2 && nRefEndX >= nVisX1 &&

Reply via email to