Added null pointer checks && Removed duplicate file existence checks.
This commit is contained in:
parent
923ba12ae9
commit
07ee870601
@ -407,10 +407,12 @@ std::string JsonFile_Parse(const char *path_to_file, Json_Value *pJson_Value)
|
|||||||
if (!err_str.empty())
|
if (!err_str.empty())
|
||||||
return err_str;
|
return err_str;
|
||||||
|
|
||||||
// 尝试打开文件
|
// 检查空指针
|
||||||
|
if (pJson_Value == nullptr)
|
||||||
|
return "Null container ptr.";
|
||||||
|
|
||||||
|
// 打开已完成检查的文件
|
||||||
FILE *pFile = fopen(path_to_file, "rb");
|
FILE *pFile = fopen(path_to_file, "rb");
|
||||||
if (pFile == nullptr)
|
|
||||||
return "file \"" + std::string(path_to_file) + "\" open failed.";
|
|
||||||
|
|
||||||
// 跳过空白部分 return -> skip count
|
// 跳过空白部分 return -> skip count
|
||||||
auto Lambda_skip_blank = [&](void) -> size_t
|
auto Lambda_skip_blank = [&](void) -> size_t
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user