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:37:16 +0000
commit52aa68ba22e62a6c4e2699574cc6dd812c011c51 (patch)
tree452e344639227e8957e351e30e3c20d379c2744d /sw
parentb6842e227d979c24b50fe5971d183f58df4788e3 (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/5435 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 f8b224fdd977..689ac04bfdb4 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1121,25 +1121,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();