diff --git a/src/ScriptEditor/ui/ScriptEditorRoot.tsx b/src/ScriptEditor/ui/ScriptEditorRoot.tsx index cdd285130..19b57474f 100644 --- a/src/ScriptEditor/ui/ScriptEditorRoot.tsx +++ b/src/ScriptEditor/ui/ScriptEditorRoot.tsx @@ -121,6 +121,16 @@ export function Root(props: IProps): React.ReactElement { vim: props.vim || Settings.MonacoVim, }); + // Prevent Crash if script is open on deleted server + openScripts = openScripts.filter((script) => { + return GetServer(script.hostname) !== null; + }) + if (currentScript && (GetServer(currentScript.hostname) === null)) { + currentScript = openScripts[0]; + if (currentScript === undefined) currentScript = null; + } + + const [dimensions, setDimensions] = useState({ height: window.innerHeight, width: window.innerWidth,