Skip to content

Commit 07e5d9c

Browse files
authored
Fix bug where iterator was used after the underlying item was erased from the container (#2412)
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
1 parent a3e9f8d commit 07e5d9c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/systems/physics/EntityFeatureMap.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ namespace systems::physics_system
226226
if (it != this->entityMap.end())
227227
{
228228
this->reverseMap.erase(it->second);
229-
this->entityMap.erase(it);
230229
this->castCache.erase(_entity);
230+
this->entityMap.erase(it);
231231
return true;
232232
}
233233
return false;
@@ -242,8 +242,8 @@ namespace systems::physics_system
242242
if (it != this->reverseMap.end())
243243
{
244244
this->entityMap.erase(it->second);
245-
this->reverseMap.erase(it);
246245
this->castCache.erase(it->second);
246+
this->reverseMap.erase(it);
247247
return true;
248248
}
249249
return false;

0 commit comments

Comments
 (0)