API: Print error message when calling ns.ui.closeTail with nonexistent pid or pid of stopped scripts (#2557)

This commit is contained in:
catloversg
2026-03-08 03:05:21 +07:00
committed by GitHub
parent f8bb1ed997
commit e06fb3dd9d

View File

@@ -70,7 +70,12 @@ export function NetscriptUserInterface(): InternalAPI<IUserInterface> {
(ctx) =>
(_pid = ctx.workerScript.scriptRef.pid) => {
const pid = helpers.number(ctx, "pid", _pid);
//Emit an event to tell the game to close the tail window if it exists
const runningScriptObj = helpers.getRunningScript(ctx, pid);
if (runningScriptObj == null) {
helpers.log(ctx, () => helpers.getCannotFindRunningScriptErrorMessage(pid));
return;
}
// Emit an event to tell the game to close the tail window if it exists.
LogBoxCloserEvents.emit(pid);
},