diff options
author | Eike Rathke <erack@redhat.com> | 2022-06-14 13:55:09 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-06-27 13:30:25 +0200 |
commit | 8905d516cfecb2a3d6a4302fee162b9be6e5049f (patch) | |
tree | d31489618bbe6ad4217220d0d3afc16b8007e4b1 | |
parent | 84e51f196567b358f0889c9052a8a2b1615541c3 (diff) |
Related: tdf#149325 Fix yet another VbaRange empty ScRangeList access
Change-Id: If2c44795ab794482b841138bdd55f37c4d30b592
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135824
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
(cherry picked from commit 9470c5531dc928d438a6a7f4d47f2d82f2296cc1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135874
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/vba/vbarange.cxx | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index ca77bae6c093..6ee791bf7212 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -6717,7 +6717,9 @@ uno::Reference<sheet::XSheetCellCursor> SAL_CALL ScTableSheetObj::createCursorBy if (pRangesImp) { const ScRangeList& rRanges = pRangesImp->GetRangeList(); - OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" ); + SAL_WARN_IF( rRanges.size() != 1, "sc", "ScTableSheetObj::createCursorByRange: Range? Ranges?"); + if (rRanges.empty()) + return nullptr; return new ScCellCursorObj( pDocSh, rRanges[ 0 ] ); } } diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index eaba743db01b..92c281cfb8ac 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -1285,9 +1285,12 @@ uno::Reference< sheet::XSheetCellRange > lclExpandToMerged( const uno::Reference { aOldAddress = aNewAddress; uno::Reference< sheet::XSheetCellCursor > xCursor( xSheet->createCursorByRange( xNewCellRange ), uno::UNO_SET_THROW ); - xCursor->collapseToMergedArea(); - xNewCellRange.set( xCursor, uno::UNO_QUERY_THROW ); - aNewAddress = lclGetRangeAddress( xNewCellRange ); + if (xCursor.is()) + { + xCursor->collapseToMergedArea(); + xNewCellRange.set( xCursor, uno::UNO_QUERY_THROW ); + aNewAddress = lclGetRangeAddress( xNewCellRange ); + } } while( bRecursive && (aOldAddress != aNewAddress) ); return xNewCellRange; |