From 336ff3ea7cd68e72ca93d950f69ec01c1648be6c Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 29 Jan 2022 18:12:30 +0100 Subject: [PATCH] Added an extra assert macro to GuiComponent. --- es-core/src/GuiComponent.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/es-core/src/GuiComponent.h b/es-core/src/GuiComponent.h index 627eed940..7aa9cc844 100644 --- a/es-core/src/GuiComponent.h +++ b/es-core/src/GuiComponent.h @@ -127,7 +127,11 @@ public: void sortChildren(); const unsigned int getChildCount() const { return static_cast(mChildren.size()); } const int getChildIndex() const; - GuiComponent* getChild(unsigned int i) const { return mChildren.at(i); } + GuiComponent* getChild(unsigned int i) const + { + assert(mChildren.size() >= i); + return mChildren.at(i); + } // Animation will be automatically deleted when it completes or is stopped. const bool isAnimationPlaying(unsigned char slot) const