Commit 39d8c46
authored
fix(autoware_utils_geometry): add optional check (#89)
fix(autoware_utils_geometry): add optional check before accessing value in triangulate
Add a check for empty optional before calling .value() on alt_poly.
If alt::Polygon2d::create() returns std::nullopt (e.g., for polygons
with less than 4 points), the function now returns an empty vector
instead of throwing std::bad_optional_access.
Detected by Facebook Infer static analyzer (OPTIONAL_EMPTY_ACCESS).
Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp>1 parent c75228a commit 39d8c46
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
624 | 624 | | |
625 | 625 | | |
626 | 626 | | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
627 | 631 | | |
628 | 632 | | |
629 | 633 | | |
| |||
0 commit comments