Skip to content

Commit

Permalink
Fix get_bone_position() on unset bones modifying their position
Browse files Browse the repository at this point in the history
closes #11840
  • Loading branch information
sfan5 committed Dec 5, 2021
1 parent ff934d5 commit d9d2193
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/server/unit_sao.cpp
Expand Up @@ -84,8 +84,11 @@ void UnitSAO::setBonePosition(const std::string &bone, v3f position, v3f rotatio

void UnitSAO::getBonePosition(const std::string &bone, v3f *position, v3f *rotation)
{
*position = m_bone_position[bone].X;
*rotation = m_bone_position[bone].Y;
auto it = m_bone_position.find(bone);
if (it != m_bone_position.end()) {
*position = it->second.X;
*rotation = it->second.Y;
}
}

// clang-format off
Expand Down

0 comments on commit d9d2193

Please sign in to comment.