mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-07-08 00:05:00 +00:00
Fix the 'Bounding Box' node crashing on empty or single-point vector data input (#2529)
* Make Bounding Box have empty output on empty input Fixes a crash when using the text tool and the Text node is connected to a Bounding Box node. * Use .map().unwrap_or_default() --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
93f7004ece
commit
c137e44b71
1 changed files with 4 additions and 2 deletions
|
@ -942,8 +942,10 @@ async fn bounding_box(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTa
|
|||
let vector_data_transform = vector_data.transform();
|
||||
let vector_data = vector_data.one_instance().instance;
|
||||
|
||||
let bounding_box = vector_data.bounding_box_with_transform(vector_data_transform).unwrap();
|
||||
let mut result = VectorData::from_subpath(Subpath::new_rect(bounding_box[0], bounding_box[1]));
|
||||
let mut result = vector_data
|
||||
.bounding_box_with_transform(vector_data_transform)
|
||||
.map(|bounding_box| VectorData::from_subpath(Subpath::new_rect(bounding_box[0], bounding_box[1])))
|
||||
.unwrap_or_default();
|
||||
result.style = vector_data.style.clone();
|
||||
result.style.set_stroke_transform(DAffine2::IDENTITY);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue