summaryrefslogtreecommitdiff
path: root/sc
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 12:08:55 -0400
commit7e26ebc502dbef4f2bb75e1a4082cd1774b7e3bb (patch)
tree6549b1dcf87c3a106bd015a25b82dc9a20e0662a /sc
parent79299cd95f9b52d2ccd6973781e922381aa74281 (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 (cherry picked from commit 3dcfb9a892e528a386bb304e4e00d2fa34b1de25)
Diffstat (limited to 'sc')
-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 7e9f6bd66846..1e41bd0268aa 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1130,15 +1130,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)
{
@@ -1254,8 +1257,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.