From d9eaa2076de595178071ba5095d655fe45088d08 Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Mon, 8 Apr 2019 10:36:58 -0700 Subject: [PATCH 1/2] Fix out of bounds when the model url is incorrect --- libraries/hfm/src/hfm/HFM.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/hfm/src/hfm/HFM.cpp b/libraries/hfm/src/hfm/HFM.cpp index e930f30d1a..6a9a714234 100644 --- a/libraries/hfm/src/hfm/HFM.cpp +++ b/libraries/hfm/src/hfm/HFM.cpp @@ -166,7 +166,9 @@ void HFMModel::computeKdops() { glm::vec3(INV_SQRT_3, INV_SQRT_3, -INV_SQRT_3), glm::vec3(INV_SQRT_3, -INV_SQRT_3, -INV_SQRT_3) }; - + if (joints.size() != shapeVertices.size()) { + return; + } // now that all joints have been scanned compute a k-Dop bounding volume of mesh for (int i = 0; i < joints.size(); ++i) { HFMJoint& joint = joints[i]; From 0d92ec1f5bf7cab065c39271cf70816b98170846 Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Mon, 8 Apr 2019 11:24:59 -0700 Subject: [PATCH 2/2] Fix comparison warning --- libraries/hfm/src/hfm/HFM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/hfm/src/hfm/HFM.cpp b/libraries/hfm/src/hfm/HFM.cpp index 6a9a714234..236445bfda 100644 --- a/libraries/hfm/src/hfm/HFM.cpp +++ b/libraries/hfm/src/hfm/HFM.cpp @@ -166,7 +166,7 @@ void HFMModel::computeKdops() { glm::vec3(INV_SQRT_3, INV_SQRT_3, -INV_SQRT_3), glm::vec3(INV_SQRT_3, -INV_SQRT_3, -INV_SQRT_3) }; - if (joints.size() != shapeVertices.size()) { + if (joints.size() != (int)shapeVertices.size()) { return; } // now that all joints have been scanned compute a k-Dop bounding volume of mesh