Skip to content

Commit

Permalink
Fix potential segfault if BaseInterpolation init failed
Browse files Browse the repository at this point in the history
  • Loading branch information
epernod committed May 13, 2024
1 parent 93f790d commit 0d50672
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/BeamAdapter/component/BeamInterpolation.inl
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,12 @@ void BeamInterpolation<DataTypes>::init()
template <class DataTypes>
void BeamInterpolation<DataTypes>::bwdInit()
{
this->d_componentState.setValue(ComponentState::Loading);
BaseBeamInterpolation<DataTypes>::bwdInit();

if (this->d_componentState.getValue() == ComponentState::Invalid)
return;

Size nbEdges = this->m_topology->getNbEdges();
auto youngModulus = sofa::helper::getWriteOnlyAccessor(d_defaultYoungModulus);
if (youngModulus.size() != nbEdges)
Expand Down

0 comments on commit 0d50672

Please sign in to comment.