Browse Source

Added a range check on GetDragElement(unsigned).

hdunderscore 11 years ago
parent
commit
00656c5d30
1 changed files with 3 additions and 0 deletions
  1. 3 0
      Source/Engine/UI/UI.cpp

+ 3 - 0
Source/Engine/UI/UI.cpp

@@ -646,6 +646,9 @@ const Vector<UIElement*> UI::GetDragElements()
 UIElement* UI::GetDragElement(unsigned index)
 UIElement* UI::GetDragElement(unsigned index)
 {
 {
     GetDragElements();
     GetDragElements();
+    if (index >= dragElementsConfirmed_.Size())
+        return (UIElement*)0;
+        
     return dragElementsConfirmed_[index];
     return dragElementsConfirmed_[index];
 }
 }