Skip to content

Commit

Permalink
fix(core): error thrown when deleting an entity after its creation
Browse files Browse the repository at this point in the history
  • Loading branch information
HoyosJuan committed Nov 5, 2024
1 parent 81ba90f commit eb9e0cd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/core/src/ifc/IfcPropertiesManager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,10 @@ export class IfcPropertiesManager extends Component implements Disposable {
for (const expressID of changes) {
const data = (await model.getProperties(expressID)) as any;
if (!data) {
ifcApi.DeleteLine(modelID, expressID);
// If the expressID doesn't exist in the original file, then do nothing.
// This prevents a memory access out of bounds error from WebIfc.
const existed = ifcApi.GetLine(modelID, expressID);
if (existed) ifcApi.DeleteLine(modelID, expressID);
} else {
ifcApi.WriteLine(modelID, data);
}
Expand Down

0 comments on commit eb9e0cd

Please sign in to comment.