UI: Do not close scripts in editor when their servers are deleted (#2049)

This commit is contained in:
catloversg
2025-03-30 10:26:45 +07:00
committed by GitHub
parent 12d18c21f1
commit 0900f46edb
4 changed files with 18 additions and 12 deletions
+3 -1
View File
@@ -7,7 +7,9 @@ import { throwIfReachable } from "../../utils/helpers/throwIfReachable";
function getServerCode(scripts: OpenScript[], index: number): string | null {
const openScript = scripts[index];
const server = GetServer(openScript.hostname);
if (server === null) throw new Error(`Server '${openScript.hostname}' should not be null, but it is.`);
if (server === null) {
return null;
}
const data = server.getContentFile(openScript.path)?.content ?? null;
return data;
}