소스 검색

Update simObject.cpp

better way to handle the validity check for const char*
Areloch 6 년 전
부모
커밋
173dbc8868
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      Engine/source/console/simObject.cpp

+ 2 - 1
Engine/source/console/simObject.cpp

@@ -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 ];