App: Bugfix for NULL-Pointer dereference of Property->getName()

This commit is contained in:
wmayer
2022-01-16 14:30:51 +01:00
parent b836712c83
commit f147986fa9
14 changed files with 40 additions and 16 deletions

View File

@@ -236,7 +236,7 @@ struct ShapeCache {
void slotChanged(const App::DocumentObject &obj, const App::Property &prop) {
const char *propName = prop.getName();
if(!propName)
if(!App::Property::isValidName(propName))
return;
if(strcmp(propName,"Shape")==0
|| strcmp(propName,"Group")==0

View File

@@ -340,7 +340,7 @@ App::DocumentObject* TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::st
App::Property* cprop = *it++;
if( strcmp(prop->getName(), "Label") == 0 ) {
if( prop->getName() && strcmp(prop->getName(), "Label") == 0 ) {
static_cast<App::PropertyString*>(cprop)->setValue(name.c_str());
continue;
}

View File

@@ -435,7 +435,7 @@ void relinkToBody (PartDesign::Feature *feature) {
}
}
if ( !valueStr.empty () ) {
if ( !valueStr.empty () && prop->hasName()) {
FCMD_OBJ_CMD(obj,prop->getName() << '=' << valueStr);
}
}

View File

@@ -141,7 +141,7 @@ App::Property *DlgSheetConf::prepare(CellAddress &from, CellAddress &to,
vexpr->getPath().getProperty());
if(prop) {
auto obj = Base::freecad_dynamic_cast<DocumentObject>(prop->getContainer());
if(obj) {
if (obj && prop->hasName()) {
path = ObjectIdentifier(sheet);
path.setDocumentObjectName(obj,true);
path << ObjectIdentifier::SimpleComponent(prop->getName());