[Libreoffice-commits] .: Branch 'libreoffice-3-3' - sw/source

Petr Mladek pmladek at kemper.freedesktop.org
Tue Mar 8 11:15:34 PST 2011


 sw/source/core/crsr/bookmrk.cxx |    2 +-
 sw/source/core/inc/bookmrk.hxx  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5974be757044982b8f510c5fc642e8e03ae62c74
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Tue Mar 8 16:32:57 2011 +0100

    n#663622: Fix the positions of imported fields to avoid crashes
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 1f9f14a..3989ac5 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 88683ca..8878dbe 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( );


More information about the Libreoffice-commits mailing list