diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 93086e7a8..a44f938e4 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -3386,28 +3386,28 @@ bool NppParameters::writeProjectPanelsSettings() const TiXmlNode *nppRoot = _pXmlUserDoc->FirstChild(TEXT("NotepadPlus")); if (!nppRoot) return false; - TiXmlNode *projPanelRootNode = nppRoot->FirstChildElement(TEXT("ProjectPanels")); - if (projPanelRootNode) + TiXmlNode *oldProjPanelRootNode = nppRoot->FirstChildElement(TEXT("ProjectPanels")); + if (nullptr != oldProjPanelRootNode) { // Erase the Project Panel root - nppRoot->RemoveChild(projPanelRootNode); + nppRoot->RemoveChild(oldProjPanelRootNode); } // Create the Project Panel root - projPanelRootNode = new TiXmlElement(TEXT("ProjectPanels")); + TiXmlElement projPanelRootNode{TEXT("ProjectPanels")}; // Add 3 Project Panel parameters for (int i = 0 ; i < 3 ; ++i) { - TiXmlElement projPanelNode(TEXT("ProjectPanel")); + TiXmlElement projPanelNode{TEXT("ProjectPanel")}; (projPanelNode.ToElement())->SetAttribute(TEXT("id"), i); (projPanelNode.ToElement())->SetAttribute(TEXT("workSpaceFile"), _workSpaceFilePathes[i]); - (projPanelRootNode->ToElement())->InsertEndChild(projPanelNode); + (projPanelRootNode.ToElement())->InsertEndChild(projPanelNode); } // (Re)Insert the Project Panel root - (nppRoot->ToElement())->InsertEndChild(*projPanelRootNode); + (nppRoot->ToElement())->InsertEndChild(projPanelRootNode); return true; }