aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/unit_sao.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/server/unit_sao.cpp b/src/server/unit_sao.cpp
index acbdd478a..9a49b0f43 100644
--- a/src/server/unit_sao.cpp
+++ b/src/server/unit_sao.cpp
@@ -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