mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-01-10 23:37:33 +01:00
fixes #2119 close open scripts that exist on deleted servers
this prevents a crash by trying to open the script editor with a script open that exists on a server that has been deleted this is achieved by filtering the list of open scripts whenever the editor is opened and removing any that exist on a server that has been deleted it also handles the case of the selected script being one that was removed in which case it defaults to selecting the first script
This commit is contained in:
parent
b578e09986
commit
a20dd47ec6
@ -120,6 +120,15 @@ 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];
|
||||
}
|
||||
|
||||
|
||||
const [dimensions, setDimensions] = useState({
|
||||
height: window.innerHeight,
|
||||
width: window.innerWidth,
|
||||
|
Loading…
Reference in New Issue
Block a user