mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Merge pull request #2323 from Areloch/getFieldValueCrashfix
Sanity check for calling getFieldValue
This commit is contained in:
commit
847618f4af
|
|
@ -2834,13 +2834,16 @@ DefineEngineMethod( SimObject, getFieldValue, const char*, ( const char* fieldNa
|
|||
"@param index Optional parameter to specify the index of an array field separately.\n"
|
||||
"@return The value of the given field or \"\" if undefined." )
|
||||
{
|
||||
const U32 nameLen = dStrlen( fieldName );
|
||||
if (nameLen == 0)
|
||||
return "";
|
||||
|
||||
char fieldNameBuffer[ 1024 ];
|
||||
char arrayIndexBuffer[ 64 ];
|
||||
|
||||
// Parse out index if the field is given in the form of 'name[index]'.
|
||||
|
||||
const char* arrayIndex = NULL;
|
||||
const U32 nameLen = dStrlen( fieldName );
|
||||
if( fieldName[ nameLen - 1 ] == ']' )
|
||||
{
|
||||
const char* leftBracket = dStrchr( fieldName, '[' );
|
||||
|
|
|
|||
Loading…
Reference in a new issue