Fix crash when loading string property in json that is not a string
Fixes #178
This commit is contained in:
13
Source/ThirdParty/rapidjson/document.h
vendored
13
Source/ThirdParty/rapidjson/document.h
vendored
@@ -1679,7 +1679,18 @@ public:
|
||||
//@{
|
||||
|
||||
const Ch* GetString() const { RAPIDJSON_ASSERT(IsString()); return (data_.f.flags & kInlineStrFlag) ? data_.ss.str : GetStringPointer(); }
|
||||
::String GetText() const { RAPIDJSON_ASSERT(IsString()); return ::String(GetString(), GetStringLength()); }
|
||||
::String GetText() const
|
||||
{
|
||||
::String result;
|
||||
if (IsString())
|
||||
{
|
||||
if (data_.f.flags & kInlineStrFlag)
|
||||
result.Set(data_.ss.str, data_.ss.GetLength());
|
||||
else
|
||||
result.Set(GetStringPointer(), data_.s.length);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//! Get the length of string.
|
||||
/*! Since rapidjson permits "\\u0000" in the json string, strlen(v.GetString()) may not equal to v.GetStringLength().
|
||||
|
||||
Reference in New Issue
Block a user