Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
fix: Some trade options crash KS
Browse files Browse the repository at this point in the history
When a race trades a resource that hasn't been unlocked through embassy level yet, this caused the trade computation to fail with an unexpected error.

Fixes #100
  • Loading branch information
oliversalzburg committed Jun 14, 2022
1 parent 65520e0 commit 85d308d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/userscript/source/TradeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ export class TradeManager {
const output: Partial<Record<Resource, number>> = {};
for (const item of race.sells) {
if (!this._isValidTrade(item, race)) {
// Still put invalid trades into the result to not cause missing keys.
output[item.name] = 0;
continue;
}

Expand Down

0 comments on commit 85d308d

Please sign in to comment.