diff options
author | sfan5 <sfan5@live.de> | 2021-12-06 00:04:33 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-12-06 00:06:49 +0100 |
commit | d9d219356aa31cd953303580ccde7f0e27dd0fe6 (patch) | |
tree | 854aa4b73ba715e7d620b619945816fa34c66e66 /src | |
parent | ff934d538c00518476c31f5df6ebc4be5ca79591 (diff) | |
download | minetest-d9d219356aa31cd953303580ccde7f0e27dd0fe6.tar.gz minetest-d9d219356aa31cd953303580ccde7f0e27dd0fe6.tar.bz2 minetest-d9d219356aa31cd953303580ccde7f0e27dd0fe6.zip |
Fix get_bone_position() on unset bones modifying their position
closes #11840
Diffstat (limited to 'src')
-rw-r--r-- | src/server/unit_sao.cpp | 7 |
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 |