Skip to content

Commit 1ba845e

Browse files
committed
Account for possibility of non-optical surface or absent property table
1 parent a6bb7c2 commit 1ba845e

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/celeritas/ext/detail/GeantSurfacePhysicsHelper.hh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,13 @@ GeantSurfacePhysicsHelper::GeantSurfacePhysicsHelper(SurfaceId sid) : sid_(sid)
7272
auto* g4surf_prop = g4log_surf->GetSurfaceProperty();
7373
CELER_ASSERT(g4surf_prop);
7474
surface_ = dynamic_cast<G4OpticalSurface*>(g4surf_prop);
75-
CELER_ASSERT(surface_);
76-
get_property_ = GeantMaterialPropertyGetter{
77-
surface_->GetMaterialPropertiesTable(), surface_->GetName()};
75+
if (surface_)
76+
{
77+
// The surface may not be an optical surface, or it might have no
78+
// properties
79+
get_property_ = GeantMaterialPropertyGetter{
80+
surface_->GetMaterialPropertiesTable(), surface_->GetName()};
81+
}
7882
}
7983

8084
//---------------------------------------------------------------------------//

0 commit comments

Comments
 (0)