[BUG_FIXED] (Author: Ivan Radić, aka Loreia) Fix a crash issue due to the inconsistent userDefineLang.xml.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@976 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2012-11-03 11:48:35 +00:00
parent 377a9ebca7
commit 9aeb967892
2 changed files with 8 additions and 5 deletions

View File

@ -2828,7 +2828,7 @@ void StyleArray::addStyler(int styleID, TiXmlNode *styleNode)
{
styleID = (styleID & 0xFFFF);
index = styleID;
if (index >= SCE_USER_STYLE_TOTAL_STYLES)
if (index >= SCE_USER_STYLE_TOTAL_STYLES || _styleArray[index]._styleID != -1)
return;
}
@ -5349,7 +5349,8 @@ void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *user
TiXmlElement *styleRootElement = (rootElement->InsertEndChild(TiXmlElement(TEXT("Styles"))))->ToElement();
for (int i = 0 ; i < userLang->_styleArray.getNbStyler() ; i++)
//for (int i = 0 ; i < userLang->_styleArray.getNbStyler() ; i++)
for (int i = 0 ; i < SCE_USER_STYLE_TOTAL_STYLES ; i++)
{
TiXmlElement *styleElement = (styleRootElement->InsertEndChild(TiXmlElement(TEXT("WordsStyle"))))->ToElement();
Style style2Write = userLang->_styleArray.getStyler(i);
@ -5405,8 +5406,9 @@ void NppParameters::stylerStrOp(bool op)
{
for (int i = 0 ; i < _nbUserLang ; i++)
{
int nbStyler = _userLangArray[i]->_styleArray.getNbStyler();
for (int j = 0 ; j < nbStyler ; j++)
//int nbStyler = _userLangArray[i]->_styleArray.getNbStyler();
//for (int j = 0 ; j < nbStyler ; j++)
for (int j = 0 ; j < SCE_USER_STYLE_TOTAL_STYLES ; j++)
{
Style & style = _userLangArray[i]->_styleArray.getStyler(j);

View File

@ -766,7 +766,8 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName)
char intBuffer[10];
char nestingBuffer[] = "userDefine.nesting.00";
for (int i = 0 ; i < userLangContainer->_styleArray.getNbStyler() ; i++)
//for (int i = 0 ; i < userLangContainer->_styleArray.getNbStyler() ; i++)
for (int i = 0 ; i < SCE_USER_STYLE_TOTAL_STYLES ; i++)
{
Style & style = userLangContainer->_styleArray.getStyler(i);