1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-14 15:40:18 +00:00

Throw on invalid bone group indices in getActiveGroup

This commit is contained in:
Alexei Kotov 2024-06-12 22:54:05 +03:00
parent b001deeff7
commit d226b72592

View File

@ -218,6 +218,8 @@ namespace MWLua
getMutableAnimationOrThrow(ObjectVariant(object))->adjustSpeedMult(groupname, speed);
};
api["getActiveGroup"] = [](const sol::object& object, MWRender::BoneGroup boneGroup) -> std::string_view {
if (boneGroup < 0 || boneGroup >= BoneGroup::Num_BoneGroups)
throw std::runtime_error("Invalid bonegroup: " + std::to_string(boneGroup));
return getConstAnimationOrThrow(ObjectVariant(object))->getActiveGroup(boneGroup);
};