[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - sw/source

Caolán McNamara caolanm at redhat.com
Thu Aug 15 06:37:18 PDT 2013


 sw/source/core/docnode/ndtbl.cxx |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 3ea53259def615152c2edb0381cbe0cd5a78cc48
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Aug 15 11:39:59 2013 +0100

    Resolves: fdo#67554 avoid ooxml import crash
    
    check if the endrange is empty before dereferencing
    
    while I'm at it, don't copy the entire vector and make it a little more
    readable
    
    Change-Id: I1f2a0096791ca0ef51aad595f71e1a18aa448c3b
    (cherry picked from commit ce791697cbf260b592f7cad095539a414888823f)
    Reviewed-on: https://gerrit.libreoffice.org/5434
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index df85ebc..7505830 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1116,25 +1116,24 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
     if (rTableNodes.empty())
         return NULL;
 
-    std::vector<SwNodeRange> rFirstRange = *rTableNodes.begin();
+    const std::vector<SwNodeRange>& rFirstRange = *rTableNodes.begin();
 
     if (rFirstRange.empty())
         return NULL;
 
+    const std::vector<SwNodeRange>& rLastRange = *rTableNodes.rbegin();
+
+    if (rLastRange.empty())
+        return NULL;
+
     /* Save first node in the selection if it is a content node. */
     SwCntntNode * pSttCntntNd = rFirstRange.begin()->aStart.GetNode().GetCntntNode();
 
-    /**debug**/
-#if OSL_DEBUG_LEVEL > 1
-    const SwNodeRange& rStartRange = *rTableNodes.begin()->begin();
-    const SwNodeRange& rEndRange = *rTableNodes.rbegin()->rbegin();
-    (void) rStartRange;
-    (void) rEndRange;
-#endif
-    /**debug**/
+    const SwNodeRange& rStartRange = *rFirstRange.begin();
+    const SwNodeRange& rEndRange = *rLastRange.rbegin();
 
     //!!! not necessarily TextNodes !!!
-    SwPaM aOriginal( rTableNodes.begin()->begin()->aStart, rTableNodes.rbegin()->rbegin()->aEnd );
+    SwPaM aOriginal( rStartRange.aStart, rEndRange.aEnd );
     const SwPosition *pStt = aOriginal.GetMark();
     const SwPosition *pEnd = aOriginal.GetPoint();
 


More information about the Libreoffice-commits mailing list