From dc8d912884f4893f2a3f553ecfe732a234d04e0d Mon Sep 17 00:00:00 2001 From: Attila Szűcs Date: Tue, 21 Jun 2022 15:27:35 +0200 Subject: tdf#149574 sc: fix missing nullptr check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression from commit 605b4ba57b2daa447af9d43d3759079e15df8148 "tdf#43958 sc: fix fill by selecting merged cell". Check if GetPattern(actual cell) is not nullptr, before using it. This is not the real problem of Bug 149574, but it is a problem anyway, and it fixes this bug. The real problem is the wrong ViewData::nTabNo, that point to an already deleted table, (fixed in 954d119db932434dc976ef739c643be0d9c7023c "tdf#149502 sc: crash fix: Change in Table destruction"). Co-authored-by: Tibor Nagy (NISZ) Change-Id: I26fc629ccf354c9e0c2662d61254d01be91d08f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136230 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit c4c827e1d370dcc351c4dddc601b3c37fc71564b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136323 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sc/source/ui/view/viewdata.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 6ac95430a84e..5cee19f21eb7 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1153,7 +1153,7 @@ ScMarkType ScViewData::GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) if (eMarkType == SC_MARK_NONE) eMarkType = SC_MARK_SIMPLE; const ScPatternAttr* pMarkPattern = mrDoc.GetPattern(GetCurX(), GetCurY(), GetTabNo()); - if (pMarkPattern->GetItemSet().GetItemState(ATTR_MERGE, false) == SfxItemState::SET) + if (pMarkPattern && pMarkPattern->GetItemSet().GetItemState(ATTR_MERGE, false) == SfxItemState::SET) { SCROW nRow = pMarkPattern->GetItem(ATTR_MERGE).GetRowMerge(); SCCOL nCol = pMarkPattern->GetItem(ATTR_MERGE).GetColMerge(); -- cgit