[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();
|
StyleArray & globalStyles = (NppParameters::getInstance())->getGlobalStylers();
|
||||||
int i = globalStyles.getStylerIndexByID(STYLE_DEFAULT);
|
int i = globalStyles.getStylerIndexByID(STYLE_DEFAULT);
|
||||||
Style & style = globalStyles.getStyler(i);
|
if (i != -1)
|
||||||
(NppParameters::getInstance())->setCurrentDefaultFgColor(style._fgColor);
|
{
|
||||||
(NppParameters::getInstance())->setCurrentDefaultBgColor(style._bgColor);
|
Style & style = globalStyles.getStyler(i);
|
||||||
|
(NppParameters::getInstance())->setCurrentDefaultFgColor(style._fgColor);
|
||||||
|
(NppParameters::getInstance())->setCurrentDefaultBgColor(style._bgColor);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// launch the plugin dlg memorized at the last session
|
// 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"));
|
patterns.push_back(TEXT("*.xml"));
|
||||||
|
|
||||||
generic_string nppDir = pNppParams->getNppPath();
|
generic_string nppDir = pNppParams->getNppPath();
|
||||||
#ifdef UNICODE
|
|
||||||
LocalizationSwitcher & localizationSwitcher = pNppParams->getLocalizationSwitcher();
|
LocalizationSwitcher & localizationSwitcher = pNppParams->getLocalizationSwitcher();
|
||||||
wstring localizationDir = nppDir;
|
wstring localizationDir = nppDir;
|
||||||
PathAppend(localizationDir, TEXT("localization\\"));
|
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());
|
localizationSwitcher.addLanguageFromXml(fileNames[i].c_str());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
fileNames.clear();
|
fileNames.clear();
|
||||||
ThemeSwitcher & themeSwitcher = pNppParams->getThemeSwitcher();
|
ThemeSwitcher & themeSwitcher = pNppParams->getThemeSwitcher();
|
||||||
|
@ -397,7 +397,14 @@ public:
|
|||||||
void setNbStyler(int nb) {_nbStyler = nb;};
|
void setNbStyler(int nb) {_nbStyler = nb;};
|
||||||
|
|
||||||
Style & getStyler(int index) {
|
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];
|
return _styleArray[index];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1534,7 +1541,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void saveConfig_xml() {
|
void saveConfig_xml() {
|
||||||
_pXmlUserDoc->SaveFile();
|
if (_pXmlUserDoc)
|
||||||
|
_pXmlUserDoc->SaveFile();
|
||||||
};
|
};
|
||||||
|
|
||||||
generic_string getUserPath() const {
|
generic_string getUserPath() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user