summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-07-04 14:06:26 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2023-07-12 18:53:31 +0200
commit97bd5151bb064bc4019b5a37165b34b1039572ce (patch)
treef9e67bd04f27fd1a0e8b4fecfc7bf1da48351b1a
parent2e7f0326cc240c48e6e49498dabe9d805c3b89ac (diff)
sc: fix crash in ScVbaWorksheet::Cells
See https://crashreport.libreoffice.org/stats/signature/ScDocShell::GetDocument() Similar to 286a1c03fa10acf60f076a0af987112d24cb2ff5 "sc: check excel::getDocShell" Change-Id: I102e575b4992e175d4e780ef2b43f887d94bbd24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153964 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit c7a8889302fd7e9e0665c3d21510e374cff3891e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153992 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit a2427519315f07b6c79d8456b9b7c128371b7e74) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154008 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: خالد حسني <khaled@libreoffice.org> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--sc/source/ui/vba/vbaworksheet.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index abd76c6023c6..53bdc893281a 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -681,8 +681,9 @@ ScVbaWorksheet::Cells( const ::uno::Any &nRow, const ::uno::Any &nCol )
// Use a common helper method instead of creating a new ScVbaRange object
uno::Reference< table::XCellRange > xRange( getSheet(), uno::UNO_QUERY_THROW );
uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
- ScDocument& rDoc = excel::getDocShell( xModel )->GetDocument();
- return ScVbaRange::CellsHelper( rDoc, this, mxContext, xRange, nRow, nCol );
+ if(ScDocShell* pShell = excel::getDocShell( xModel ))
+ return ScVbaRange::CellsHelper(pShell->GetDocument(), this, mxContext, xRange, nRow, nCol );
+ throw uno::RuntimeException();
}
uno::Reference< excel::XRange >