mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
style.assign_representation_styles: fix crash on IfcPresentationStyleAssignment #7883
When replacing a style on an item whose previous IfcStyledItem wraps its styles in the deprecated IfcPresentationStyleAssignment, and the assignment is not being reused (use_style_assignment is False, e.g. an IFC4 file authored by AVEVA E3D), the else branch called remove_same_type_styles(style_assignment) with style_assignment still None, raising AttributeError: 'NoneType' object has no attribute 'Styles'. Operate on style_, the assignment found in the current iteration, instead of the accumulator. Verified red-green with a minimal IFC4 file using IfcPresentationStyleAssignment. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
committed by
Dion Moult
parent
209c44db83
commit
82f73c29ea
@@ -162,7 +162,11 @@ class Usecase:
|
||||
style_assignment = style_
|
||||
self.remove_same_type_styles(style_assignment, current_style_type, remove_item=False)
|
||||
else:
|
||||
self.remove_same_type_styles(style_assignment, current_style_type, remove_item=True)
|
||||
# Operate on the assignment found in this iteration, not the
|
||||
# style_assignment accumulator, which is still None when the
|
||||
# file uses IfcPresentationStyleAssignment but we are not
|
||||
# reusing it (e.g. an IFC4 file authored by AVEVA E3D). See #7883.
|
||||
self.remove_same_type_styles(style_, current_style_type, remove_item=True)
|
||||
|
||||
if use_style_assignment:
|
||||
if style_assignment:
|
||||
|
||||
Reference in New Issue
Block a user