Skip to content

Commit c2e030b

Browse files
committed
fix(SurfaceMesh): safer usage of Polygon
1 parent fa33bc0 commit c2e030b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/geode/mesh/core/surface_mesh.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ namespace geode
290290
{
291291
OPENGEODE_EXCEPTION( polygon_id < mesh.nb_polygons(),
292292
"[Impl::polygon_minimum_height] Wrong polygon id" );
293-
return mesh.polygon( polygon_id ).minimum_height();
293+
const auto polygon = mesh.polygon( polygon_id );
294+
return polygon.minimum_height();
294295
}
295296

296297
std::optional< PolygonVertex > polygon_around_vertex(
@@ -1138,7 +1139,8 @@ namespace geode
11381139
SurfaceMesh< dimension >::polygon_normal( index_t polygon_id ) const
11391140
{
11401141
check_polygon_id( *this, polygon_id );
1141-
return this->polygon( polygon_id ).normal();
1142+
const auto polygon = this->polygon( polygon_id );
1143+
return polygon.normal();
11421144
}
11431145

11441146
template < index_t dimension >
@@ -1170,7 +1172,8 @@ namespace geode
11701172
index_t polygon_id ) const
11711173
{
11721174
check_polygon_id( *this, polygon_id );
1173-
return this->polygon( polygon_id ).is_degenerated();
1175+
const auto polygon = this->polygon( polygon_id );
1176+
return polygon.is_degenerated();
11741177
}
11751178

11761179
template < index_t dimension >

0 commit comments

Comments
 (0)