fix fatal error when skeleton is missing

This commit is contained in:
MihailRis 2026-01-18 23:35:18 +03:00
parent b2df0a7e91
commit 8b5261f4f1
3 changed files with 16 additions and 5 deletions

View file

@ -147,7 +147,7 @@ void Entities::loadEntity(const dv::value& map, Entity entity) {
if (map.has(COMP_TRANSFORM)) {
transform.deserialize(map[COMP_TRANSFORM]);
}
if (skeleton == nullptr) {
if (skeleton == nullptr || skeleton->config == nullptr) {
return;
}
std::string skeletonName = skeleton->config->getName();
@ -397,6 +397,9 @@ void Entities::renderDebug(
ctx.setLineWidth(2);
for (auto [entity, transform, skeleton] : view.each()) {
auto config = skeleton.config;
if (config == nullptr) {
continue;
}
const auto& pos = transform.pos;
const auto& size = transform.size;
if (frustum && !frustum->isBoxVisible(pos - size, pos + size)) {
@ -434,9 +437,11 @@ void Entities::render(
}
const auto* rigConfig = skeleton.config;
rigConfig->render(
assets, batch, skeleton, transform.rot, pos, size
);
if (rigConfig) {
rigConfig->render(
assets, batch, skeleton, transform.rot, pos, size
);
}
}
}