summaryrefslogtreecommitdiff
path: root/sw/source/filter/rtf/rtffld.cxx
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2012-08-02 12:05:06 +0200
committerPetr Mladek <pmladek@suse.cz>2012-08-02 15:38:28 +0200
commit0e79ad05e76bed420383156aaafcad08d5e34fa8 (patch)
treefaaf9284d7b3fcd1f56edfb8043696358648b46f /sw/source/filter/rtf/rtffld.cxx
parentd5345bfb40d6e33087fd053cc220308a2bc2945e (diff)
some tweaks in RTF filter
Signed-off-by: Petr Mladek <pmladek@suse.cz>
Diffstat (limited to 'sw/source/filter/rtf/rtffld.cxx')
-rw-r--r--sw/source/filter/rtf/rtffld.cxx19
1 files changed, 14 insertions, 5 deletions
diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx
index 5886fcf1bf61..95dead0d5af6 100644
--- a/sw/source/filter/rtf/rtffld.cxx
+++ b/sw/source/filter/rtf/rtffld.cxx
@@ -156,7 +156,10 @@ static RTF_FLD_TYPES _WhichFld( String& rName, String& rNext )
{
rName = rName.Copy( nFndPos, static_cast< xub_StrLen >(nLen) );
nFndPos += nTokenStt + static_cast< xub_StrLen >(nLen);
- while( rNext.GetChar( nFndPos ) == ' ' ) ++nFndPos;
+ while ((nFndPos < rNext.Len()) && (rNext.GetChar(nFndPos) == ' '))
+ {
+ ++nFndPos;
+ }
rNext.Erase( 0, nFndPos );
rNext = comphelper::string::stripEnd(rNext, ' ');
return aFldNmArr[n].eFldType;
@@ -388,8 +391,10 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
{
xub_StrLen nStartDel = nPos;
nPos += 2;
- while (aSaveStr.GetChar(nPos) == ' ')
+ while ((nPos < aSaveStr.Len()) && (aSaveStr.GetChar(nPos) == ' '))
+ {
++nPos;
+ }
if (aSaveStr.EqualsIgnoreCaseAscii("MERGEFORMAT", nPos, 11))
{
xub_StrLen nNoDel = (nPos + 11 ) - nStartDel;
@@ -431,7 +436,9 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
if( STRING_NOTFOUND != ( nPos = aSaveStr.SearchAscii( "\\*" )) )
{
nPos += 2;
- while( aSaveStr.GetChar(nPos) == ' ' ) nPos++;
+ while ((nPos < aSaveStr.Len()) &&
+ (aSaveStr.GetChar(nPos) == ' '))
+ { nPos++; }
aSaveStr.Erase( 0, nPos );
// steht jetzt geanu auf dem Format-Namen
@@ -450,7 +457,9 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
if( STRING_NOTFOUND != ( nPos = aSaveStr.SearchAscii( "\\*" )) )
{
nPos += 2;
- while( aSaveStr.GetChar(nPos) == ' ' ) nPos++;
+ while ((nPos < aSaveStr.Len()) &&
+ (aSaveStr.GetChar(nPos) == ' '))
+ { nPos++; }
aSaveStr.Erase( 0, nPos );
// steht jetzt geanu auf dem Format-Namen
@@ -530,7 +539,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
// werden:
// \\data -> Datenbank-Name als Field
// DATA -> Datenbank-Info
- sal_Bool bField = rFieldStr.GetChar( 0 ) != 'D';
+ bool const bField = rFieldStr.Len() && rFieldStr.GetChar(0) != 'D';
// nur der Name interressiert
if( STRING_NOTFOUND != (nPos = aSaveStr.Search( '.' )) )