diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-01-23 12:09:55 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-01-23 12:09:55 +0100 |
commit | 6acfc822566ca3c7d9fdd4af37ad5104a00d5d35 (patch) | |
tree | 1e83fc5c669c342eb9c6918bd43defa6914f2619 /chart2 | |
parent | a4f97070bdb6172c684ec175c3e6e2a550eb9630 (diff) |
Allow for null xModel in TitleHelper::getTitle
Witnessed a JunitTest_chart2_unoapi failure where (deep within Idle::Timeout)
chart::impl::ModelState::update is apparently called with a null xModel. All
the code called from there appears to be careful to handle a null xModel, except
for chart::TitleHelper::getTitle, which---presumably by accident---stopped doing
so with 401f01caf5b357ac6c15b37a89c0a9aaeb46f4e4 "use ChartModel instead of
XModel in a few places."
Change-Id: I5788b5e41a6d68fe193cb214d736ee54c4c581d7
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/tools/TitleHelper.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx index 26bffc3459aa..3c58947ae8b2 100644 --- a/chart2/source/tools/TitleHelper.cxx +++ b/chart2/source/tools/TitleHelper.cxx @@ -152,19 +152,19 @@ uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIn uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex , const uno::Reference< frame::XModel >& xModel ) { + uno::Reference< XTitled > xTitled; if(nTitleIndex == TitleHelper::MAIN_TITLE) { - uno::Reference< XTitled > xTitled( xModel, uno::UNO_QUERY ); - return xTitled->getTitleObject(); + xTitled.set( xModel, uno::UNO_QUERY ); + } + else + { + uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY ); + uno::Reference< XDiagram > xDiagram; + if( xChartDoc.is()) + xDiagram.set( xChartDoc->getFirstDiagram()); + xTitled = lcl_getTitleParent( nTitleIndex, xDiagram ); } - - uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY ); - uno::Reference< XDiagram > xDiagram; - - if( xChartDoc.is()) - xDiagram.set( xChartDoc->getFirstDiagram()); - - uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xDiagram ) ); if( xTitled.is()) return xTitled->getTitleObject(); return NULL; |