Update simObject.cpp

better way to handle the validity check for const char*
This commit is contained in:
Areloch 2019-02-23 20:14:10 -06:00 committed by GitHub
parent 6f418cc183
commit a4fde427b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2834,7 +2834,8 @@ 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." )
{
if (fieldName == "")
const U32 nameLen = dStrlen( fieldName );
if (nameLen == 0)
return "";
char fieldNameBuffer[ 1024 ];