Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/convert/gltf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,10 @@ fn animations(ctx: &Ctx, gltf: &mut GlTF) {
_ => continue,
};

let curves = &object_curves[object_idx as usize];
let curves = match object_curves.get(object_idx as usize) {
Some(c) => c,
None => continue, // no animation data for this object
};

// Add channels for any of the TRSs that are animated for this
// object
Expand Down Expand Up @@ -576,7 +579,7 @@ fn animations(ctx: &Ctx, gltf: &mut GlTF) {
// Now use the sampler descriptions to write the actual samplers
let samplers = sampler_descs.iter().map(|desc| {
let &SamplerDescriptor { object_idx, path } = desc;
let curves = &object_curves[object_idx as usize];
let curves = &object_curves[object_idx as usize]; // safe: only indices that passed bounds check above are in sampler_descs

let domain = match path {
SamplerPath::Translation => curves.translation.domain(),
Expand Down