Skip to content

Commit 88f2119

Browse files
committed
Resolved nullptr bug in lod32 attribute fetching
1 parent a9c24c9 commit 88f2119

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

inc/cjCreator.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3198,7 +3198,6 @@ std::vector< CJT::GeoObject>CJGeoCreator::makeLoD32(DataManager* h, CJT::Kernel*
31983198
const IfcSchema::IfcProduct* product = currentFacePair.second;
31993199
std::string productType = product->data().type()->name();
32003200
const TopoDS_Face& currentFace = currentFacePair.first;
3201-
32023201
builder.Add(collectionShape, currentFace);
32033202

32043203
if (productType == "IfcPlate") //TODO: make this smarter
@@ -3230,7 +3229,6 @@ std::vector< CJT::GeoObject>CJGeoCreator::makeLoD32(DataManager* h, CJT::Kernel*
32303229
objectMap[CJObjectEnum::getString(CJObjectID::ifcName)] = product->Name().get();
32313230
}
32323231
objectMap[CJObjectEnum::getString(CJObjectID::ifcGuid)] = product->GlobalId();
3233-
32343232
if (productType == "IfcWindow")
32353233
{
32363234
objectMap[CJObjectEnum::getString(CJObjectID::CJType)] = CJObjectEnum::getString(CJObjectID::CJTypeWindow);
@@ -3240,8 +3238,8 @@ std::vector< CJT::GeoObject>CJGeoCreator::makeLoD32(DataManager* h, CJT::Kernel*
32403238
objectMap[CJObjectEnum::getString(CJObjectID::CJType)] = CJObjectEnum::getString(CJObjectID::CJTypeDoor);
32413239
}
32423240

3243-
32443241
std::vector<nlohmann::json> attributeList = helperFunctions::collectPropertyValues(product->GlobalId(), h->getSourceFile(0));
3242+
32453243
for (nlohmann::json attributeObject : attributeList)
32463244
{
32473245
for (auto jsonObIt = attributeObject.begin(); jsonObIt != attributeObject.end(); ++jsonObIt) {

inc/helper.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2282,8 +2282,6 @@ std::vector<nlohmann::json> helperFunctions::collectPropertyValues(std::string o
22822282
#else
22832283
IfcSchema::IfcObject::list::ptr relatedObjectList = relDefItem->RelatedObjects();
22842284
#endif
2285-
2286-
22872285
bool match = false;
22882286
for (auto objectIt = relatedObjectList->begin(); objectIt != relatedObjectList->end(); objectIt++)
22892287
{
@@ -2297,15 +2295,18 @@ std::vector<nlohmann::json> helperFunctions::collectPropertyValues(std::string o
22972295
#else
22982296
IfcSchema::IfcPropertySetDefinition* propertyDef = relDefItem->RelatingPropertyDefinition();
22992297
#endif
2298+
if (propertyDef == nullptr) { continue; }
23002299

23012300
if (propertyDef->data().type()->name() != "IfcPropertySet") { continue; }
23022301
IfcSchema::IfcPropertySet* propertySet = relDefItem->RelatingPropertyDefinition()->as<IfcSchema::IfcPropertySet>();
23032302
IfcSchema::IfcProperty::list::ptr propertyList = propertySet->HasProperties();
23042303
for (auto propertyIt = propertyList->begin(); propertyIt != propertyList->end(); propertyIt++)
23052304
{
2305+
if (*propertyIt == nullptr) { continue; }
23062306
IfcSchema::IfcPropertySingleValue* propertyItem = (*propertyIt)->as<IfcSchema::IfcPropertySingleValue>();
23072307

23082308
IfcSchema::IfcValue* ifcValue = propertyItem->NominalValue();
2309+
if (ifcValue == nullptr) { continue; }
23092310

23102311
std::string propertyIdName = ifcValue->data().type()->name();
23112312

inc/helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#define USE_IFC2x3
1+
#define USE_IFC4
22

33
#ifdef USE_IFC2x3
44
#define IfcSchema Ifc2x3

0 commit comments

Comments
 (0)