From 0d50672da9e4a99a2a4fd779b01961010c1f1184 Mon Sep 17 00:00:00 2001 From: epernod Date: Mon, 13 May 2024 16:07:21 +0200 Subject: [PATCH] Fix potential segfault if BaseInterpolation init failed --- src/BeamAdapter/component/BeamInterpolation.inl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/BeamAdapter/component/BeamInterpolation.inl b/src/BeamAdapter/component/BeamInterpolation.inl index e6328422..396e53a4 100644 --- a/src/BeamAdapter/component/BeamInterpolation.inl +++ b/src/BeamAdapter/component/BeamInterpolation.inl @@ -131,8 +131,12 @@ void BeamInterpolation::init() template void BeamInterpolation::bwdInit() { + this->d_componentState.setValue(ComponentState::Loading); BaseBeamInterpolation::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)