Browse Source

Fixed uninitialized memory in UIHorizontalStack that was introduced by replacing std::vector

Jorrit Rouwe 1 year ago
parent
commit
f3791e4c69
1 changed files with 2 additions and 2 deletions
  1. 2 2
      TestFramework/UI/UIHorizontalStack.cpp

+ 2 - 2
TestFramework/UI/UIHorizontalStack.cpp

@@ -14,7 +14,7 @@ JPH_IMPLEMENT_RTTI_VIRTUAL(UIHorizontalStack)
 void UIHorizontalStack::sUniformChildWidth(UIElement *inParent)
 {
 	Array<int> sizes;
-	sizes.resize(1);
+	sizes.resize(1, 0);
 	for (UIElement *e : inParent->GetChildren())
 	{
 		e->AutoLayout();
@@ -23,7 +23,7 @@ void UIHorizontalStack::sUniformChildWidth(UIElement *inParent)
 		if (horiz != nullptr)
 		{
 			if (horiz->GetNumChildren() > (int)sizes.size())
-				sizes.resize(horiz->GetNumChildren());
+				sizes.resize(horiz->GetNumChildren(), 0);
 			for (int i = 0; i < horiz->GetNumChildren(); ++i)
 				sizes[i] = max(sizes[i], horiz->GetChild(i)->GetWidth());
 		}