Protect against double overbar format conversion.

This commit is contained in:
Jeff Young 2021-06-20 11:17:07 +01:00
parent b72545a432
commit 5a43392eae
1 changed files with 8 additions and 2 deletions

View File

@ -54,9 +54,9 @@ wxString ConvertToNewOverbarNotation( const wxString& aOldStr )
{
if( *chIt == '~' )
{
wxString::const_iterator lookahead = chIt;
wxString::const_iterator lookahead = chIt + 1;
if( ++lookahead != aOldStr.end() && *lookahead == '~' )
if( lookahead != aOldStr.end() && *lookahead == '~' )
{
if( ++lookahead != aOldStr.end() && *lookahead == '{' )
{
@ -71,6 +71,12 @@ wxString ConvertToNewOverbarNotation( const wxString& aOldStr )
++chIt;
continue;
}
else if( lookahead != aOldStr.end() && *lookahead == '{' )
{
// Could mean the user wants "{" with an overbar, but more likely this
// is a case of double notation conversion. Bail out.
return aOldStr;
}
else
{
if( inOverbar )