diff options
Diffstat (limited to 'sc/source/ui/view/viewdata.cxx')
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 511051d6f49c..332356dd794f 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1433,7 +1433,13 @@ SCCOL ScViewData::GetCurXForTab( SCTAB nTabIndex ) const if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size())) || !maTabData[nTabIndex]) return -1; - return maTabData[nTabIndex]->nCurX; + ScViewDataTable* pTabData = maTabData[nTabIndex].get(); + if (!pTabData) + { + SAL_WARN("sc.viewdata", "ScViewData::GetCurXForTab : hidden sheet = " << nTabIndex); + return -1; + } + return pTabData->nCurX; } SCROW ScViewData::GetCurYForTab( SCTAB nTabIndex ) const @@ -1441,7 +1447,13 @@ SCROW ScViewData::GetCurYForTab( SCTAB nTabIndex ) const if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size()))) return -1; - return maTabData[nTabIndex]->nCurY; + ScViewDataTable* pTabData = maTabData[nTabIndex].get(); + if (!pTabData) + { + SAL_WARN("sc.viewdata", "ScViewData::GetCurYForTab : hidden sheet = " << nTabIndex); + return -1; + } + return pTabData->nCurY; } void ScViewData::SetCurXForTab( SCCOL nNewCurX, SCTAB nTabIndex ) @@ -1449,7 +1461,14 @@ void ScViewData::SetCurXForTab( SCCOL nNewCurX, SCTAB nTabIndex ) if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size()))) return; - maTabData[nTabIndex]->nCurX = nNewCurX; + ScViewDataTable* pTabData = maTabData[nTabIndex].get(); + if (!pTabData) + { + SAL_WARN("sc.viewdata", "ScViewData::SetCurXForTab : hidden sheet = " << nTabIndex); + return; + } + + pTabData->nCurX = nNewCurX; } void ScViewData::SetCurYForTab( SCCOL nNewCurY, SCTAB nTabIndex ) @@ -1457,7 +1476,14 @@ void ScViewData::SetCurYForTab( SCCOL nNewCurY, SCTAB nTabIndex ) if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size()))) return; - maTabData[nTabIndex]->nCurY = nNewCurY; + ScViewDataTable* pTabData = maTabData[nTabIndex].get(); + if (!pTabData) + { + SAL_WARN("sc.viewdata", "ScViewData::SetCurYForTab : hidden sheet = " << nTabIndex); + return; + } + + pTabData->nCurY = nNewCurY; } void ScViewData::SetMaxTiledCol( SCCOL nNewMaxCol ) |