From e2fb15a70332488438a36e73742cb8d11cd716aa Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sat, 28 Oct 2023 19:24:27 +0200 Subject: [PATCH] Fix docking panel crash due to messing up config.xml Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13084#issuecomment-1783787209 --- PowerEditor/src/Notepad_plus.cpp | 4 ++-- PowerEditor/src/Parameters.cpp | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 3e61e5374..bb18ba5eb 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -1063,9 +1063,9 @@ void Notepad_plus::saveDockingParams() { 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; - else + else if (nppGUI._dockingData._pluginDockInfo[i]._prevContainer <= DOCKCONT_MAX) floatCont = nppGUI._dockingData._pluginDockInfo[i]._prevContainer; if (floatCont >= 0) diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 020d497aa..b616e2ddf 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -6582,12 +6582,11 @@ void NppParameters::feedDockingManager(TiXmlNode *node) const TCHAR *idStr = dlgElement->Attribute(TEXT("id"), &id); if (name && idStr) { - int curr = 0; // on left + int current = 0; // on left int prev = 0; // on left - dlgElement->Attribute(TEXT("curr"), &curr); + dlgElement->Attribute(TEXT("curr"), ¤t); dlgElement->Attribute(TEXT("prev"), &prev); - bool isVisible = false; const TCHAR *val = dlgElement->Attribute(TEXT("isVisible")); if (val) @@ -6595,7 +6594,7 @@ void NppParameters::feedDockingManager(TiXmlNode *node) 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)); } }