From f51d63f9321a9d6d62c18001372978500276eaf8 Mon Sep 17 00:00:00 2001 From: mozman Date: Tue, 11 Feb 2025 20:20:38 +0100 Subject: [PATCH] auditor deletes entities in OBJECTS section without owner handle #1240 --- src/ezdxf/sections/objects.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ezdxf/sections/objects.py b/src/ezdxf/sections/objects.py index aed8c0f27..be06b3c5a 100644 --- a/src/ezdxf/sections/objects.py +++ b/src/ezdxf/sections/objects.py @@ -709,6 +709,14 @@ def audit_objects(self): current_db_size = len(auditor.entitydb) for entity in self.objects: + if not entity.dxf.hasattr("owner"): + # check_owner_exist() ignores entities without owner handle + auditor.fixed_error( + code=AuditError.INVALID_OWNER_HANDLE, + message=f"Deleted {str(entity)} entity without owner handle.", + ) + auditor.trash(entity) + continue auditor.check_owner_exist(entity) entity.audit(auditor)