BUGFIX: Prevent crash that could occur with server named runningScripts (#502)

This commit is contained in:
Snarling
2023-05-03 20:19:56 -04:00
committed by GitHub
parent 003be33886
commit d25254caf1
5 changed files with 21 additions and 18 deletions
+5
View File
@@ -21,6 +21,7 @@ import { LiteratureName } from "src/Literature/data/LiteratureNames";
import { CompletedProgramName } from "src/Programs/Programs";
import { getKeyList } from "../utils/helpers/getKeyList";
import lodash from "lodash";
import { Settings } from "../Settings/Settings";
import type { ScriptKey } from "../utils/helpers/scriptKey";
@@ -292,6 +293,10 @@ export abstract class BaseServer implements IServer {
// RunningScripts are stored as a simple array, both for backward compatibility,
// compactness, and ease of filtering them here.
const result = Generic_toJSON(ctorName, this, keys);
if (Settings.ExcludeRunningScriptsFromSave) {
result.data.runningScripts = [];
return result;
}
const rsArray: RunningScript[] = [];
for (const byPid of this.runningScriptMap.values()) {