fix: 增加对空设置文件的处理,确保返回空对象

This commit is contained in:
catlog22
2026-01-21 17:04:16 +08:00
parent 890ca455b2
commit 2084ff3e21

View File

@@ -39,6 +39,9 @@ function readSettingsFile(filePath: string): Record<string, unknown> {
return {};
}
const content = readFileSync(filePath, 'utf8');
if (!content.trim()) {
return {};
}
return JSON.parse(content);
} catch (error: unknown) {
console.error(`Error reading settings file ${filePath}:`, error);