Skip to content

Commit

Permalink
Merge branch 'main' into bhata/updateCatch
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Stone <[email protected]>
  • Loading branch information
jstone-lucasfilm authored Oct 24, 2023
2 parents ea91fc1 + a5b832d commit 19238c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/MaterialXCore/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void Element::setChildIndex(const string& name, int index)
return;
}

if (index < 0 || index > (int) _childOrder.size())
if (index < 0 || index >= (int) _childOrder.size())
{
throw Exception("Invalid child index");
}
Expand Down
3 changes: 3 additions & 0 deletions source/MaterialXTest/MaterialXCore/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ TEST_CASE("Element", "[element]")
REQUIRE(*doc2 != *doc);
doc2->setChildIndex("elem1", doc2->getChildIndex("elem2"));
REQUIRE(*doc2 == *doc);
REQUIRE_THROWS_AS(doc2->setChildIndex("elem1", -100), mx::Exception);
REQUIRE_THROWS_AS(doc2->setChildIndex("elem1", -1), mx::Exception);
REQUIRE_THROWS_AS(doc2->setChildIndex("elem1", 2), mx::Exception);
REQUIRE_THROWS_AS(doc2->setChildIndex("elem1", 100), mx::Exception);
REQUIRE(*doc2 == *doc);

Expand Down

0 comments on commit 19238c4

Please sign in to comment.