summaryrefslogtreecommitdiff
path: root/sc/source/ui/docshell
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-06-16 10:43:08 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-06-16 10:49:01 -0400
commit3dcfb9a892e528a386bb304e4e00d2fa34b1de25 (patch)
treeefa0ff11cb6a9b165df26e63c89f294699d5a7b3 /sc/source/ui/docshell
parentfe5b3c3357d9e613a0be53ec1e5546a59e21cea0 (diff)
Cache table entry may be null. Let's not assume it's always non-null.
This is done intentionally because we do need correct table index when resolving external reference. This requires we do need to allocate array with the same sheet size as the remote document. But we don't allocate Table instances for remote sheets that we don't reference, to save memory. Change-Id: I27fb6228f0e4558327aa4a04a6bccce8d2f1085f
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx16
1 files changed, 11 insertions, 5 deletions
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index a4d03f29b080..ab9a7b9b8d16 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1118,15 +1118,18 @@ void ScExternalRefCache::getAllCachedDataSpans( sal_uInt16 nFileId, sc::ColumnSp
const std::vector<TableTypeRef>& rTables = pDocItem->maTables;
for (size_t nTab = 0, nTabCount = rTables.size(); nTab < nTabCount; ++nTab)
{
- const Table& rTable = *rTables[nTab];
+ TableTypeRef pTab = rTables[nTab];
+ if (!pTab)
+ continue;
+
std::vector<SCROW> aRows;
- rTable.getAllRows(aRows);
+ pTab->getAllRows(aRows);
std::vector<SCROW>::const_iterator itRow = aRows.begin(), itRowEnd = aRows.end();
for (; itRow != itRowEnd; ++itRow)
{
SCROW nRow = *itRow;
std::vector<SCCOL> aCols;
- rTable.getAllCols(nRow, aCols);
+ pTab->getAllCols(nRow, aCols);
std::vector<SCCOL>::const_iterator itCol = aCols.begin(), itColEnd = aCols.end();
for (; itCol != itColEnd; ++itCol)
{
@@ -1242,8 +1245,11 @@ void ScExternalRefCache::clearCacheTables(sal_uInt16 nFileId)
std::vector<TableTypeRef>& rTabs = pDocItem->maTables;
for (size_t i = 0, n = rTabs.size(); i < n; ++i)
{
- Table& rTab = *rTabs[i];
- rTab.clear();
+ TableTypeRef pTab = rTabs[i];
+ if (!pTab)
+ continue;
+
+ pTab->clear();
}
// Clear the external range name caches.