summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-08-15 11:39:59 +0100
committerFridrich Strba <fridrich@documentfoundation.org>2013-08-15 13:36:54 +0000
commit3ea53259def615152c2edb0381cbe0cd5a78cc48 (patch)
treeea5bf34d2f3ad05af46fa773a931556d289f129f /sw
parentd91469d6efe46cf4cccf0026b1cb9a1112c970b7 (diff)
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@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/docnode/ndtbl.cxx19
1 files changed, 9 insertions, 10 deletions
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index df85ebce8a96..75058307b70e 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();