fix(config): 解决目录列表加载错误问题

- 添加了 ListDirBegin 方法的错误检查
- 在遇到错误时返回 null 避免异常
- 确保目录遍历前检查操作状态
This commit is contained in:
GeWuYou 2026-04-11 07:41:55 +08:00
parent abf78aa934
commit 1c064bfe66

View File

@ -623,7 +623,12 @@ internal sealed class GodotYamlConfigEnvironment
} }
var entries = new List<GodotYamlConfigDirectoryEntry>(); var entries = new List<GodotYamlConfigDirectoryEntry>();
directory.ListDirBegin(); var listDirectoryError = directory.ListDirBegin();
if (listDirectoryError != Error.Ok)
{
return null;
}
while (true) while (true)
{ {
var name = directory.GetNext(); var name = directory.GetNext();