From 36c1e928ca74ae85da13881f78f67e9780bf6b0e Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Mon, 15 Jan 2024 17:04:25 -0600 Subject: [PATCH] don't allow setting a key or value on -1 index --- Engine/source/console/arrayObject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/console/arrayObject.cpp b/Engine/source/console/arrayObject.cpp index 60a36e9c9..cfd25d6cb 100644 --- a/Engine/source/console/arrayObject.cpp +++ b/Engine/source/console/arrayObject.cpp @@ -450,7 +450,7 @@ void ArrayObject::append(ArrayObject* obj) void ArrayObject::setKey( const String &key, S32 index ) { - if ( index >= mArray.size() ) + if (index >= mArray.size() || index < 0) return; mArray[index].key = key; @@ -460,7 +460,7 @@ void ArrayObject::setKey( const String &key, S32 index ) void ArrayObject::setValue( const String &value, S32 index ) { - if ( index >= mArray.size() ) + if (index >= mArray.size() || index < 0) return; mArray[index].value = value;