mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 10:06:47 +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>
(cherry picked from commit 82f73c29ea)
This commit is contained in:
committed by
Dion Moult
parent
f761156dea
commit
1416af510a
@@ -160,7 +160,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