Skip to content

BUGFIX: Augmentations page crashes after grafting an aug if player has not installed any augs - #3094

Open
catloversg wants to merge 1 commit into
bitburner-official:devfrom
catloversg:pull-request/bugfix/Augmentations-page-crashes-after-grafting-an-aug-if-player-has-not-installed-any-augs
Open

BUGFIX: Augmentations page crashes after grafting an aug if player has not installed any augs#3094
catloversg wants to merge 1 commit into
bitburner-official:devfrom
catloversg:pull-request/bugfix/Augmentations-page-crashes-after-grafting-an-aug-if-player-has-not-installed-any-augs

Conversation

@catloversg

Copy link
Copy Markdown
Collaborator

MRE:

  • Load a clean save file.
  • Set SF4 and SF10.
  • Run the test code and switch to the Augmentations page immediately.

When the player has no installed augs, selectedAug is undefined. InstalledAugmentations is rerendered every cycle. After finishing grafting the first aug, sourceAugs contains 1 aug, so the sourceAugs.length > 0 block is rendered, but selectedAug is undefined, so it crashes at selectedAug.name.

Test code:

/** @param {NS} ns */
export async function main(ns) {
  Player.augmentations.length = 0;
  Player.queuedAugmentations.length = 0;
  Player.money = 1e100;
  ns.singularity.travelToCity("New Tokyo");
  ns.grafting.graftAugmentation("Augmented Targeting I", false);
  await ns.sleep(3000);
  Player.processWork(1e6);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant