From 5e42d48308a4f21cc5f4e0fc53a3effcf1dfdcf1 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Wed, 4 Sep 2019 18:32:14 +0800 Subject: [PATCH] App: improve document::readObjects() --- src/App/Document.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index a4810f5fec..f82e6814e5 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -1982,7 +1982,7 @@ Document::readObjects(Base::XMLReader& reader) reader.readElement("Object"); std::string type = reader.getAttribute("type"); std::string name = reader.getAttribute("name"); - const char *viewType = reader.hasAttribute("ViewType")?reader.getAttribute("ViewType"):0; + std::string viewType = reader.hasAttribute("ViewType")?reader.getAttribute("ViewType"):""; bool partial = false; if(d->partialLoadObjects.size()) { @@ -2019,7 +2019,7 @@ Document::readObjects(Base::XMLReader& reader) // otherwise we may cause a dependency to itself // Example: Object 'Cut001' references object 'Cut' and removing the // digits we make an object 'Cut' referencing itself. - App::DocumentObject* obj = addObject(type.c_str(), obj_name, /*isNew=*/ false, viewType, partial); + App::DocumentObject* obj = addObject(type.c_str(), obj_name, /*isNew=*/ false, viewType.c_str(), partial); if (obj) { if(lastId < obj->_Id) lastId = obj->_Id;