Added safeguards for problems surfaced in #1618

This commit is contained in:
Lwmte 2025-03-22 00:29:33 +01:00
parent dfa8170597
commit 64a2d60d2f
2 changed files with 10 additions and 0 deletions

View file

@ -711,6 +711,10 @@ Vector3i GetJointPosition(const ItemInfo& item, const CreatureBiteInfo& bite)
Vector3 GetJointOffset(GAME_OBJECT_ID objectID, int jointIndex)
{
const auto& object = Objects[objectID];
int boneIndex = object.boneIndex + (jointIndex * 4);
if (g_Level.Bones.size() <= boneIndex)
return Vector3::Zero;
int* bonePtr = &g_Level.Bones[object.boneIndex + (jointIndex * 4)];
return Vector3(*(bonePtr + 1), *(bonePtr + 2), *(bonePtr + 3));

View file

@ -2571,6 +2571,12 @@ namespace TEN::Renderer
if (!SetupBlendModeAndAlphaTest(bucket.BlendMode, rendererPass, p))
continue;
if (_staticTextures.size() <= bucket.Texture)
{
TENLog("Attempted to set incorrect static mesh texture atlas", LogLevel::Warning);
continue;
}
BindTexture(TextureRegister::ColorMap,
&std::get<0>(_staticTextures[bucket.Texture]),
SamplerStateRegister::AnisotropicClamp);