[BUG_FIXED] Fix the crash issue while config.xml and stylers.xml are not loaded.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1319 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
24c1dab2cb
commit
51a5fbfd59
@ -665,9 +665,12 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
||||
//
|
||||
StyleArray & globalStyles = (NppParameters::getInstance())->getGlobalStylers();
|
||||
int i = globalStyles.getStylerIndexByID(STYLE_DEFAULT);
|
||||
Style & style = globalStyles.getStyler(i);
|
||||
(NppParameters::getInstance())->setCurrentDefaultFgColor(style._fgColor);
|
||||
(NppParameters::getInstance())->setCurrentDefaultBgColor(style._bgColor);
|
||||
if (i != -1)
|
||||
{
|
||||
Style & style = globalStyles.getStyler(i);
|
||||
(NppParameters::getInstance())->setCurrentDefaultFgColor(style._fgColor);
|
||||
(NppParameters::getInstance())->setCurrentDefaultBgColor(style._bgColor);
|
||||
}
|
||||
|
||||
//
|
||||
// launch the plugin dlg memorized at the last session
|
||||
|
@ -161,7 +161,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
|
||||
patterns.push_back(TEXT("*.xml"));
|
||||
|
||||
generic_string nppDir = pNppParams->getNppPath();
|
||||
#ifdef UNICODE
|
||||
|
||||
LocalizationSwitcher & localizationSwitcher = pNppParams->getLocalizationSwitcher();
|
||||
wstring localizationDir = nppDir;
|
||||
PathAppend(localizationDir, TEXT("localization\\"));
|
||||
@ -171,7 +171,6 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
|
||||
{
|
||||
localizationSwitcher.addLanguageFromXml(fileNames[i].c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
fileNames.clear();
|
||||
ThemeSwitcher & themeSwitcher = pNppParams->getThemeSwitcher();
|
||||
|
@ -397,7 +397,14 @@ public:
|
||||
void setNbStyler(int nb) {_nbStyler = nb;};
|
||||
|
||||
Style & getStyler(int index) {
|
||||
assert(index != -1);
|
||||
assert(index >= 0 && index < SCE_STYLE_ARRAY_SIZE);
|
||||
/*
|
||||
if (index < 0 || index >= SCE_STYLE_ARRAY_SIZE)
|
||||
{
|
||||
Style s;
|
||||
return s;
|
||||
}
|
||||
*/
|
||||
return _styleArray[index];
|
||||
};
|
||||
|
||||
@ -1534,7 +1541,8 @@ public:
|
||||
};
|
||||
|
||||
void saveConfig_xml() {
|
||||
_pXmlUserDoc->SaveFile();
|
||||
if (_pXmlUserDoc)
|
||||
_pXmlUserDoc->SaveFile();
|
||||
};
|
||||
|
||||
generic_string getUserPath() const {
|
||||
|
Loading…
Reference in New Issue
Block a user