From 51c1ab6b8372fa3c76a6e1adadfe16f33b519c9f Mon Sep 17 00:00:00 2001 From: Areloch Date: Fri, 19 Apr 2024 00:00:37 -0500 Subject: [PATCH] Adds a sanity check to SimObject's setFieldValue console method so if you pass in a blank field name it doesn't crash, instead asserting in debug, and logging the error in release --- Engine/source/console/simObject.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index 8417a9883..926827c86 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -3072,6 +3072,13 @@ DefineEngineMethod( SimObject, setFieldValue, bool, ( const char* fieldName, con { char fieldNameBuffer[ 1024 ]; char arrayIndexBuffer[ 64 ]; + + if( !fieldName || !fieldName[0] ) + { + AssertFatal(false, "SimObject::setFieldValue - Invalid field name."); + Con::errorf( "SimObject::setFieldValue - Invalid field name." ); + return false; + } // Parse out index if the field is given in the form of 'name[index]'.