mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-06 07:37:56 +02:00
Prevent errors thrown from terminal (#443)
At least from getFilepath function
This commit is contained in:
@@ -109,6 +109,7 @@ export function commonEditor(
|
||||
|
||||
if (isScriptFilename(filename)) {
|
||||
const filepath = Terminal.getFilepath(filename);
|
||||
if (!filepath) throw `Invalid filename: ${filename}`;
|
||||
const script = Terminal.getScript(filename);
|
||||
const fileIsNs2 = isNs2(filename);
|
||||
const code = script !== null ? script.code : fileIsNs2 ? newNs2Template : "";
|
||||
@@ -125,6 +126,7 @@ export function commonEditor(
|
||||
|
||||
if (filename.endsWith(".txt")) {
|
||||
const filepath = Terminal.getFilepath(filename);
|
||||
if (!filepath) throw `Invalid filename: ${filename}`;
|
||||
const txt = Terminal.getTextFile(filename);
|
||||
return [filepath, txt === null ? "" : txt.text];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user