summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2011-03-08 16:32:57 +0100
committerPetr Mladek <pmladek@suse.cz>2011-03-08 20:14:34 +0100
commit5974be757044982b8f510c5fc642e8e03ae62c74 (patch)
tree4db7ce30083385e7ed867abad6a0b194061e0650
parent5b8ca75bc3ef7fc23373cb7ae383ef8c75f69d1a (diff)
n#663622: Fix the positions of imported fields to avoid crashes
Signed-off-by: Petr Mladek <pmladek@suse.cz>
-rw-r--r--sw/source/core/crsr/bookmrk.cxx2
-rw-r--r--sw/source/core/inc/bookmrk.hxx2
2 files changed, 2 insertions, 2 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 1f9f14adfc..3989ac5bc8 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -83,7 +83,7 @@ namespace
SwTxtNode const * const pStartTxtNode = io_pDoc->GetNodes()[rStart.nNode]->GetTxtNode();
SwTxtNode const * const pEndTxtNode = io_pDoc->GetNodes()[rEnd.nNode]->GetTxtNode();
const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex());
- xub_StrLen nEndPos = rEnd.nContent.GetIndex() == 0 ? 0 : rEnd.nContent.GetIndex() - 1;
+ xub_StrLen nEndPos = rEnd == rStart ? rEnd.nContent.GetIndex() : rEnd.nContent.GetIndex() - 1;
const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar( nEndPos );
SwPaM aStartPaM(rStart);
SwPaM aEndPaM(rEnd);
diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx
index 88683ca2e8..8878dbe638 100644
--- a/sw/source/core/inc/bookmrk.hxx
+++ b/sw/source/core/inc/bookmrk.hxx
@@ -77,7 +77,7 @@ namespace sw { namespace mark
virtual SwPosition& GetMarkEnd() const
{
if( !IsExpanded() ) return GetMarkPos();
- if ( GetMarkPos( ) > GetOtherMarkPos( ) )
+ if ( GetMarkPos( ) >= GetOtherMarkPos( ) )
return GetMarkPos( );
else
return GetOtherMarkPos( );