Fix docking panel crash due to messing up config.xml

Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13084#issuecomment-1783787209
pull/14291/head
Don Ho 1 year ago
parent 5c80be7667
commit e2fb15a703

@ -1063,9 +1063,9 @@ void Notepad_plus::saveDockingParams()
{ {
int floatCont = 0; int floatCont = 0;
if (nppGUI._dockingData._pluginDockInfo[i]._currContainer >= DOCKCONT_MAX) if (nppGUI._dockingData._pluginDockInfo[i]._currContainer <= DOCKCONT_MAX)
floatCont = nppGUI._dockingData._pluginDockInfo[i]._currContainer; floatCont = nppGUI._dockingData._pluginDockInfo[i]._currContainer;
else else if (nppGUI._dockingData._pluginDockInfo[i]._prevContainer <= DOCKCONT_MAX)
floatCont = nppGUI._dockingData._pluginDockInfo[i]._prevContainer; floatCont = nppGUI._dockingData._pluginDockInfo[i]._prevContainer;
if (floatCont >= 0) if (floatCont >= 0)

@ -6582,12 +6582,11 @@ void NppParameters::feedDockingManager(TiXmlNode *node)
const TCHAR *idStr = dlgElement->Attribute(TEXT("id"), &id); const TCHAR *idStr = dlgElement->Attribute(TEXT("id"), &id);
if (name && idStr) if (name && idStr)
{ {
int curr = 0; // on left int current = 0; // on left
int prev = 0; // on left int prev = 0; // on left
dlgElement->Attribute(TEXT("curr"), &curr); dlgElement->Attribute(TEXT("curr"), &current);
dlgElement->Attribute(TEXT("prev"), &prev); dlgElement->Attribute(TEXT("prev"), &prev);
bool isVisible = false; bool isVisible = false;
const TCHAR *val = dlgElement->Attribute(TEXT("isVisible")); const TCHAR *val = dlgElement->Attribute(TEXT("isVisible"));
if (val) if (val)
@ -6595,7 +6594,7 @@ void NppParameters::feedDockingManager(TiXmlNode *node)
isVisible = (lstrcmp(val, TEXT("yes")) == 0); isVisible = (lstrcmp(val, TEXT("yes")) == 0);
} }
_nppGUI._dockingData._pluginDockInfo.push_back(PluginDlgDockingInfo(name, id, curr, prev, isVisible)); _nppGUI._dockingData._pluginDockInfo.push_back(PluginDlgDockingInfo(name, id, current, prev, isVisible));
} }
} }

Loading…
Cancel
Save