diff options
author | Chris Liebert <liebert@pdx.edu> | 2016-10-07 21:21:33 -0700 |
---|---|---|
committer | Chris Liebert <liebert@pdx.edu> | 2016-10-07 21:21:33 -0700 |
commit | 35889026d6027b4df785cf478f4b3a96980eed95 (patch) | |
tree | c5b3fc3a76fdd621d549fa313852c2b2b7da97cf | |
parent | e81ac971b0d24efcdadbc07c42286c92ccbdb395 (diff) | |
download | tinyobjloader-35889026d6027b4df785cf478f4b3a96980eed95.tar.gz |
added additional bounds checking
-rw-r--r-- | examples/viewer/viewer.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/examples/viewer/viewer.cc b/examples/viewer/viewer.cc index 3bce085..323faac 100644 --- a/examples/viewer/viewer.cc +++ b/examples/viewer/viewer.cc @@ -249,10 +249,9 @@ bool LoadObjAndConvert(float bmin[3], float bmax[3], { for (size_t s = 0; s < shapes.size(); s++) { size_t current_material_id = 0; - if (shapes[s].mesh.material_ids.size() > 0) { + if (shapes[s].mesh.material_ids.size() > 0 && shapes[s].mesh.material_ids.size() > s) { // Base case current_material_id = shapes[s].mesh.material_ids[s]; - std::cerr << "Setting base case: " << current_material_id << std::endl; } DrawObject o; std::vector<float> vb; // pos(3float), normal(3float), color(3float) |