Skip to content

Commit 51c1ab6

Browse files
committed
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
1 parent e5aa6e4 commit 51c1ab6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Engine/source/console/simObject.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3072,6 +3072,13 @@ DefineEngineMethod( SimObject, setFieldValue, bool, ( const char* fieldName, con
30723072
{
30733073
char fieldNameBuffer[ 1024 ];
30743074
char arrayIndexBuffer[ 64 ];
3075+
3076+
if( !fieldName || !fieldName[0] )
3077+
{
3078+
AssertFatal(false, "SimObject::setFieldValue - Invalid field name.");
3079+
Con::errorf( "SimObject::setFieldValue - Invalid field name." );
3080+
return false;
3081+
}
30753082

30763083
// Parse out index if the field is given in the form of 'name[index]'.
30773084

0 commit comments

Comments
 (0)