diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 0afbbcb588..55ae02d4d3 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -1554,7 +1554,7 @@ wxString wxXmlResourceHandler::GetText(const wxString& param, bool translate) // like "&File..." -- this is illegal in XML, so we use "_File..."): if ( *dt == amp_char ) { - if ( *(++dt) == amp_char ) + if ( dt+1 == str1.end() || *(++dt) == amp_char ) str2 << amp_char; else str2 << wxT('&') << *dt; diff --git a/utils/wxrc/wxrc.cpp b/utils/wxrc/wxrc.cpp index 9e580866c3..1998c76687 100644 --- a/utils/wxrc/wxrc.cpp +++ b/utils/wxrc/wxrc.cpp @@ -896,7 +896,9 @@ static wxString ConvertText(const wxString& str) { if (*dt == wxT('_')) { - if ( *(++dt) == wxT('_') ) + if ( *(dt+1) == 0 ) + str2 << wxT('_'); + else if ( *(++dt) == wxT('_') ) str2 << wxT('_'); else str2 << wxT('&') << *dt;