Browse Source

Node.cpp: add assert

1vanK 3 years ago
parent
commit
b40a36db97
1 changed files with 2 additions and 0 deletions
  1. 2 0
      Source/Urho3D/Scene/Node.cpp

+ 2 - 0
Source/Urho3D/Scene/Node.cpp

@@ -1283,6 +1283,8 @@ Vector<Node*> Node::GetChildrenWithTag(const String& tag, bool recursive) const
 
 
 Node* Node::GetChild(i32 index) const
 Node* Node::GetChild(i32 index) const
 {
 {
+    assert(index >= 0);
+
     if (index < 0 || index >= children_.Size())
     if (index < 0 || index >= children_.Size())
     {
     {
         URHO3D_LOGWARNING("Node* Node::GetChild(i32 index) const: index out of range");
         URHO3D_LOGWARNING("Node* Node::GetChild(i32 index) const: index out of range");