[Libreoffice-commits] core.git: sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Fri Mar 17 00:07:16 UTC 2017
sc/source/ui/vba/vbarange.cxx | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
New commits:
commit ed8a337cf6d13eda49d394558d83766131f83e54
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Mar 16 18:55:42 2017 -0400
tdf#104383: prevent crash during file load.
Apparently xView may be null sometimes.
Change-Id: Icef81159eeaf5c9bdb0a91e036019b820952d20b
Reviewed-on: https://gerrit.libreoffice.org/35304
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 2eb8a4588c88..6a35cd4ece88 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -4233,8 +4233,20 @@ ScVbaRange::ApplicationRange( const uno::Reference< uno::XComponentContext >& xC
}
}
- uno::Reference< sheet::XSpreadsheetView > xView( getCurrentExcelDoc(xContext)->getCurrentController(), uno::UNO_QUERY );
- uno::Reference< table::XCellRange > xSheetRange( xView->getActiveSheet(), uno::UNO_QUERY_THROW );
+ uno::Reference<table::XCellRange> xSheetRange;
+
+ try
+ {
+ uno::Reference<sheet::XSpreadsheetView> xView(
+ getCurrentExcelDoc(xContext)->getCurrentController(), uno::UNO_QUERY_THROW);
+
+ xSheetRange.set(xView->getActiveSheet(), uno::UNO_QUERY_THROW);
+ }
+ catch (const uno::Exception&)
+ {
+ return uno::Reference<excel::XRange>();
+ }
+
ScVbaRange* pRange = new ScVbaRange( excel::getUnoSheetModuleObj( xSheetRange ), xContext, xSheetRange );
uno::Reference< excel::XRange > xVbSheetRange( pRange );
return pRange->Range( Cell1, Cell2, true );
More information about the Libreoffice-commits
mailing list