🚨 修复Sentry报错

TypeError
Cannot read properties of null (reading 'startsWith')
This commit is contained in:
BTMuli
2026-03-13 11:25:25 +08:00
parent be7c294f7e
commit 1d810117b0

View File

@@ -1,6 +1,6 @@
/**
* 游戏文件相关功能
* @since Beta v0.9.6
* @since Beta v0.9.8
*/
import showDialog from "@comp/func/dialog.js";
@@ -40,7 +40,10 @@ export async function tryReadGameVer(gameDir: string): Promise<false | string> {
const iniRead = await readTextFileLines(iniPath);
while (true) {
const line = await iniRead.next();
if (line.value.startsWith("game_version=")) return line.value.split("=")[1];
const lineRead = line.value;
if (typeof lineRead === "string" && lineRead.startsWith("game_version=")) {
return lineRead.split("=")[1];
}
if (line.done) break;
}
}