mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 11:31:49 +00:00
fix fatal error when skeleton is missing
This commit is contained in:
parent
b2df0a7e91
commit
8b5261f4f1
3 changed files with 16 additions and 5 deletions
|
|
@ -36,6 +36,9 @@ static rigging::Skeleton* get_skeleton(lua::State* L) {
|
|||
|
||||
static int l_get_model(lua::State* L) {
|
||||
if (auto skeleton = get_skeleton(L)) {
|
||||
if (skeleton->config == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
auto& rigConfig = *skeleton->config;
|
||||
auto index = index_range_check(*skeleton, lua::tointeger(L, 2));
|
||||
const auto& modelOverride = skeleton->modelOverrides[index];
|
||||
|
|
@ -96,6 +99,9 @@ static int l_set_texture(lua::State* L) {
|
|||
|
||||
static int l_index(lua::State* L) {
|
||||
if (auto skeleton = get_skeleton(L)) {
|
||||
if (skeleton->config == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
if (auto bone = skeleton->config->find(lua::require_string(L, 2))) {
|
||||
return lua::pushinteger(L, bone->getIndex());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue