sc/source/ui/docshell/externalrefmgr.cxx |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 3dcfb9a892e528a386bb304e4e00d2fa34b1de25
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Mon Jun 16 10:43:08 2014 -0400

    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

diff --git a/sc/source/ui/docshell/externalrefmgr.cxx 
b/sc/source/ui/docshell/externalrefmgr.cxx
index a4d03f2..ab9a7b9 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.
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to