Fix get_bone_position() on unset bones modifying their position

closes #11840
master
sfan5 2021-12-06 00:04:33 +01:00
parent ff934d538c
commit d9d219356a
1 changed files with 5 additions and 2 deletions

View File

@ -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