Added null pointer checks && Removed duplicate file existence checks.

This commit is contained in:
LuChiChick 2026-04-23 11:10:38 +08:00
parent 923ba12ae9
commit 07ee870601

View File

@ -407,10 +407,12 @@ std::string JsonFile_Parse(const char *path_to_file, Json_Value *pJson_Value)
if (!err_str.empty())
return err_str;
// 尝试打开文件
// 检查空指针
if (pJson_Value == nullptr)
return "Null container ptr.";
// 打开已完成检查的文件
FILE *pFile = fopen(path_to_file, "rb");
if (pFile == nullptr)
return "file \"" + std::string(path_to_file) + "\" open failed.";
// 跳过空白部分 return -> skip count
auto Lambda_skip_blank = [&](void) -> size_t