diff options
author | László Németh <laszlo.nemeth@collabora.com> | 2016-05-21 02:26:48 +0200 |
---|---|---|
committer | László Németh <laszlo.nemeth@collabora.com> | 2016-05-21 02:49:27 +0200 |
commit | 785e530e836e98a58c51fd8cc19ba6871cd89769 (patch) | |
tree | a09c2017942c0b51a00a7b819886341f4c682d5c /editeng | |
parent | 31cfb242375c62e2ee5cbbf08eae7aaffb834dfe (diff) |
fix bad index/assertion failure with line ending autocorrect patterns
Test case: type "->" and press Enter in a new en-US text document.
Result: crash or missing replacement of the arrow.
Change-Id: I052ae868b6fe0b1e5557c40471d31a20bd1e5ca9
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index de4254289544..5545432fd11c 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -2834,8 +2834,11 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p SvxAutocorrWord* pNew = new SvxAutocorrWord(aShort, aLong); if ( Insert( pNew ) ) { - if ( IsWordDelim(rTxt[nEndPos]) ) return pNew; - } else delete pNew; + if ( (rTxt.getLength() > nEndPos && IsWordDelim(rTxt[nEndPos])) || rTxt.getLength() == nEndPos ) + return pNew; + } + else + delete pNew; } } } |