From 91da29972987bb4d715a09d94ecd2cefd3a487d4 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Wed, 15 Jul 2020 13:52:39 +0900 Subject: [PATCH] Fix inequality. Should allow 0 for bufferView. --- tiny_gltf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tiny_gltf.h b/tiny_gltf.h index 57d6283..88e1093 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -5711,7 +5711,8 @@ bool TinyGLTF::LoadFromString(Model *model, std::string *err, std::string *warn, for (auto &attribute : target) { auto bufferView = model->accessors[size_t(attribute.second)].bufferView; - if (bufferView > 0) { + // bufferView could be null(-1) for sparse morph target + if (bufferView >= 0) { model->bufferViews[size_t(bufferView)].target = TINYGLTF_TARGET_ARRAY_BUFFER; }